SRL 和 SRA 有什么区别?

What's the difference between SRL and SRA?

使用指令 srasrl 有什么变化?我无法理解两者之间的区别。使用的语言是MIPS汇编。

sll $t1,$t0,2
sra $t2,$t0,2

sll $t1,$t0,2
srl $t2,$t0,2

SLR 是一个错字,应该是 SRLSRA 执行 arithmetic shift and SRL does a logical one。因此 SRL 将移入零,而 SRA 将符号位移入。例如,将 0xFFFF1234 右移逻辑上给出 0x3FFFC48D,算术上给出 0xFFFFC48D,因为符号位为 1(假设这是 MIPS32)。欲了解更多信息,请阅读

  • What are bitwise shift (bit-shift) operators and how do they work?