Bit position: 6543210
Starting bit pattern: ..............x...............
Bit mask: 111111111111110111111111111111
----------------------------------------- AND
..............0...............
(Bit dnoted by . will remain unchaned)
|
i positions
<-------------->
1 << i = 000000..1000000000000000
~(1 << i) = 111111..0111111111111111
|
int x; int i; x = x & ~(1 << i ); // Clear bit position i in x |
#define CLRBIT( x, i ) ( x &= ~(1 << i) ) |