Why doesn't bit shift work for
This question already has an answer here:
This is because of sign extension. -1
is represented by the bit sequence containing only 1s. Using the right shift with sign extension therefore always yields the sequence with all bits 1, ie -1
, regardless of the second operand of the bitshift.
上一篇: 这个陈述是什么意思?
下一篇: 为什么不移位工作