Mail Archives: djgpp/1999/02/03/20:39:53
On Wed, 3 Feb 1999, anarko wrote:
) #define RBIT(c,b) ((uchar) (c >> (1+b)) << (1+b)) | ((uchar) (c << (8-b)) >> (8-b))
) #define SBIT(c,b,b2) (((uchar) (c << (8-b))) >> (8-b)) | (((uchar) (c >> (1+b))) << (1+b)) | b2
Damn, if I understand what you want to do, you took an insanely
complicated route to do it.
) 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))
) SBIT(c,b,b2) sets bit 'b' in char c, need to OR it with b2 also, wich
) is 0x1 for bit 0, 0x2 for bit 1, 0x4 for bit 2 etc..
) i'm sure it can be solved more easy, but i'm not that
) talent in math so this is what i managed to code :-)
To turn the b bit in byte c on, use:
#define SBIT(c,b) ((c) |= (b))
--
Daniel Reed <n AT ml DOT org>
Madness takes its toll; please have exact change.
- Raw text -