01 July 2012

Shifting bits might get unpredictable sometimes.  Shifting unsigned number is defined but for signed numbers, it's implementation defined. Compiler can preserve highest bit set (sign) or fill it with a zero.

Right Shift on signed types [gustedt.wordpress.com]

Shift-Right Versus Divide in the C Language [plunk.org/~grantham]

Bitwise shifting [lispmachine.wordpress.com]


blog comments powered by Disqus