Introduction
Bitwise operations work directly on the binary representation of integers.
| Operator | Symbol | Example | Meaning |
|---|---|---|---|
| Bitwise left shift | << | x << k | Shifts all bits of x to the left by k positions |
| Bitwise right shift | >> | x >> k | Shifts all bits of x to the right by k positions |
| Bitwise AND | & | x & y | Applies AND to each pair of corresponding bits |
| Bitwise OR | | | x | y | Applies OR to each pair of corresponding bits |
| Bitwise exclusive OR | ^ |