<<< Exclusive OR operation, XOR | Index | Floating point data type >>> |
Logical operations can be used to apply masks to bit patterns.
The masks are used when there is a need to set some bit positions to 1 or to 0.
Only specified bit positions are updated, while other bits are ignored...
...hence the technical term, bit mask.
A typical use of masks is:
Use (X OR 1) to set X bit to 1
Use (X OR 0) to leave X bit unchanged
Use (X AND 0) to set X bit to 0
Use (X AND 1) to leave X bit unchanged
<<< Exclusive OR operation, XOR | Index | Floating point data type >>> |