The bitwise operations operate on the binary level of a value instead of the value itself. Said otherwise, the bitwise operators act on the individual bits that compose a value. To understand how they work, we must first look at the binary representation of integers. We will then show what the available bitwise operators and how to use them.
Bitwise operators are listed in Table 1.
Table 1:Bitwise operators
Operator | Description |
|---|---|
| Bitwise complement |
| Bitwise AND |
| Bitwise OR |
| Bitwise XOR |
| Left Shift |
| Right Shift [1] |
Arithmetic right shift on signed integer types, logical right shift on unsigned integer types.