Why doesn't bit shift work for

This question already has an answer here:

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

  • 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.

    链接地址: http://www.djcxy.com/p/12586.html

    上一篇: 这个陈述是什么意思?

    下一篇: 为什么不移位工作