This explains it very well . There is also a brief example on the same page .
But for a real brief summary:
<< signed left shift - shifts a bit pattern to the left
0 0 1 1 1 => 0 1 1 1 0
>> signed right shift - shifts a bit pattern to the right
0 0 1 1 1 => 0 0 0 1 1
>>> unsigned right shift - shifts a zero into the leftmost position
1 1 1 0 => 0 0 1 1
~ unary bitwise complement operator
A | Result
0 | 1
1 | 0
0 | 1
1 | 0
& bitwise and
A | B | Result
0 | 0 | 0
1 | 0 | 0
0 | 1 | 0
1 | 1 | 1
^ xor
A | B | Result
0 | 0 | 0
1 | 0 | 1
0 | 1 | 1
1 | 1 | 0
| inclusive or
A | B | Result
0 | 0 | 0
1 | 0 | 1
0 | 1 | 1
1 | 1 | 1
source
share