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 - 为什么这段汇编代码不删除扩展名为 ".lnk"的文件?

c++ - 将多个 int 值存储到一个变量中 - C++

embedded - 什么是用于自学汇编语言的好的嵌入式平台?

swift - 使用 Swift/lldb 比较 Intel 和 Arm 寄存器

assembly - 在古代 NASM 版本 (0.98.39) 中,常见符号报告为 'redefined'

c++ - 在 C++ 中使用移位器和缓冲区读取二进制文件

java - Java中字节移位的奇怪行为

assembly - 当您写入标签时,Assembly 是否会创建内存位置?

assembly - 将 .data 部分中定义的整数移至寄存器

assembly - 分解旧的.COM文件。卡在48个字节之内。字节序问题?