Date: Wed, 3 Feb 1999 20:39:02 -0500 (EST) From: Daniel Reed To: djgpp AT delorie DOT com Subject: Re: Re[2]: what is wrong with this? In-Reply-To: <10991.990203@flashback.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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 Madness takes its toll; please have exact change.