assembly - SHL和SAL在80x86中的区别

标签 assembly x86-16 bit-shift

我已经学会了如何使用80x86汇编器,因此在按位移位操作中,我遇到了SAL和SHL使用的问题。我的意思是代码行之间的区别如下:

MOV X, 0AAH
SAL X, 4

MOV X, 0AAH
SHL X, 4

什么时候应该使用SHL,什么时候应该使用SAL?它们有什么区别?

最佳答案

根据this,它们是相同的:

The shift arithmetic left (SAL) and shift logical left (SHL) instructions perform the same operation; they shift the bits in the destination operand to the left (toward more significant bit locations). For each shift count, the most significant bit of the destination operand is shifted into the CF flag, and the least significant bit is cleared (see Figure 7-7 in the Intel®64 and IA-32 Architectures Software Developer'sManual, Volume 1).



两者都可能只是出于完整性考虑,因为右移有所区别。

关于assembly - SHL和SAL在80x86中的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8373415/

相关文章:

assembly - 如何知道汇编代码正在使用 RAM?

x86 - FPGA实现8086处理器的最低要求

assembly - 交换汇编语言中字符串中的字母 8086

java - 对于短值,位移位无法正常工作

binary - 负定点数表示

c++ - 从ARGB转换为RGBA

c - 如何组装 GAS 程序集并将其与 Open Watcom C 库链接?

c++ - AND 运算符 + 加法比减法快

c - 节目入口自认

assembly - 8086 assembly INT 9h : keyboard ISR implementation