Bitwise Operator
Bitwise Operations Overview
Bitwise operations fall into three major groups:
- Bitwise Logic Operators
- Bitwise Shift Operators
- Bit Rotation Operators
These operations work directly on the binary representation of integers.
1. Bitwise Logic Operators
- AND ( & )
- 0b1100 & 0b1010 = 0b1000
- OR ( | )
- 0b1100 | 0b1010 = 0b1110
- XOR ( ^ )
- 0b1100 ^ 0b1010 = 0b0110
- NOT ( ~ or ! )
- ~0b00001111 = 0b11110000