From: Edward Hill Newsgroups: comp.os.msdos.djgpp Subject: Re: Bitwise Operations? Date: Tue, 30 Mar 1999 13:33:43 -0800 Organization: Easams Engineering Systems Lines: 29 Message-ID: <37014337.3BBA@gec.nospam.com> References: <7dpfu8$2ov6$1 AT news DOT gate DOT net> NNTP-Posting-Host: pc02372.gmsws.gecm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01C-GECMMTL (Win95; I; 16bit) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Matt Murrian wrote: > > Is there a library out there that already has functions for bitwise > automations ... like checking the value of a bit, etc... #define BIT0(x) (x & 0x1) #define BIT1(x) (x & 0x2) #define BIT2(x) (x & 0x4) #define BIT3(x) (x & 0x8) #define BIT4(x) (x & 0x10) #define BIT5(x) (x & 0x20) ... then do a char thebyte = /*what ever*/; if(BIT0(thebyte)) { printf("The Bit in position 0 is set\n"); { else { printf("The Bit in posisiton 0 is not set\n"); } careful of your 'endians' though... Ed