能力值:
( LV13,RANK:400 )
|
-
-
[求助]0 day 第90页,有一句汇编不懂
要打好基础
在C语言中 >> 和 << 是逻辑移位操作,并不是循环移位操作。
举个例子
一个
DWORD a = 0x10000001000000100000000000000001;
b = a << 3;
以上代码执行后
b = 0x00001000000100000000000000001000;
可以看到最高3位(最左边的)是被丢弃了的,并不是放到最低3位,而低位多出来的用0来填充。
同理 >> 逻辑右移也是舍弃低位,空位填0
所以要上述说的循环右移7位在C语言中的做法是
1.将原数值 左移25位,结果是高25位被丢弃,而最低 7位移到高 7位,结果赋值b
2.将原数值右移 7为,结果是低 7位被丢弃,而最高25位移到低25位,结果赋值c
3.将b和c进行或运算,得到的结果就相当于a循环右移7位。
|