Bit operation cheat sheet


x ^ 0s = x

x & 1s = x

x & x = x

x | x = x

x | 0s = x

x ^ 1s = ~x

x ^ x  = 0s

x & 0s = 0s

x | 1s = 1s

a ^ b ^ a = b

a ^ b ^ b = a

 

Shifting a negative number  to right will result one more leading "1"

for example 1101>>1 is1110.

-93242 >> 40 is -1




  


Comments:

Write a comment
Anonymous

Captcha image

Reload

Type the number you see in the image above: