Re:Low Level Bit Hacks You Absolutely Must Know
by cowholio4 on Friday May 11, 2018 @03:21PM
(#17050135)
Surprised I didn’t see this one on the lists.
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n. Shifting right by n bits on a two's complement signed binary number has the effect of dividing it by 2^n, but it always rounds down (towards negative infinity).
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n. Shifting right by n bits on a two's complement signed binary number has the effect of dividing it by 2^n, but it always rounds down (towards negative infinity).