Mail Archives: djgpp/1999/02/03/21:43:29
On Wed, 3 Feb 1999, Daniel Reed wrote:
) On Wed, 3 Feb 1999, anarko wrote:
) ) RBIT(c,b) resets bit 'b' in char c
) To turn the b bit in byte c off, use:
) #define RBIT(c,b) ((c) &= ~(b))
Okay, I'm dumb. In my RBIT(), you specify the bit to turn off via its
value, not by its position.
#define RBIT(c,b) ((c) &= ~(1 << b))
should turn off bits by position.
) To turn the b bit in byte c on, use:
) #define SBIT(c,b) ((c) |= (b))
#define SBIT(c,b) ((c) |= (1 << b))
--
Daniel Reed <n AT ml DOT org>
I personally think we developed language because of our deep inner need to complain. -- Jane Wagner
- Raw text -