Bitwise Operators¶
When applied to Integer operands, these operators manipulate individual bits.
| Operator | Description | Example | Result |
|---|---|---|---|
And | Bitwise AND | 5 And 3 | 1 |
Or | Bitwise OR | 5 Or 2 | 7 |
Xor | Bitwise exclusive OR | 5 Xor 3 | 6 |
Not | Bitwise NOT (one’s complement) | Not 5 | -6 |
<< | Left shift | 1 << 3 | 8 |
>> | Right shift | 8 >> 2 | 2 |