左移和右移算子

时间:2014-06-06 14:50:16

标签: c bit-manipulation bitwise-operators

之前我问了同样的问题,但没有得到满意的答案,也许我的提问方式错了。所以,请不要因为重复投票而拒绝投票。

unsigned short int time=24446; //binary = 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0

unsigned short temp,result1,result2;

temp=time<<5;                  //binary = 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0  

result1=temp>>10;              //binary = 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1

result2=((time<<5)>>10);       //binary = 0 0 0 0 0 0 1 0 1 1 1 1 1 0 1 1

简单来说,我的问题是: -

为什么result1result2

存在差异

0 个答案:

没有答案