Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对这段代码有疑问,有人可以为我解决这个问题吗?
a=32, b=0xE
我需要解释“案例2”:
case 2: b>>=(a>>5); break;
首先,根据您的问题,现在 是 0xE十六进制表示法, 然后 使用 右移运算符(>>) 然后 14b >>= (a>>5)a = 32; b = 14;b = b >> (a >> 5)b = 14 >> (32 >> 5)b = 14 >> 1b = 7
0xE
14
b >>= (a>>5)
a = 32; b = 14;
b = b >> (a >> 5)
b = 14 >> (32 >> 5)
b = 14 >> 1
b = 7
case 2是带赋值的按位移位。
case 2
b >>= (a>>5);
是
b = b >> (a >> 5);
b = b >> (a / 2 / 2 / 2 / 2 / 2);
您也可以将右移扩展a为除以2。
a
2