Re: Code thats out there!

From: Anthony Spataro (ads@netcom.com)
Date: 06/16/95


Well, Jelson's much more elegant solution of C bitfields is your best 
bet, but assuming you had bitfield-phobia, you could do this:

#define BIT_0_IN_FIRST_LONG  0,1
#define BIT_1_IN_FIRST_LONG  0,2
#define BIT_0_IN_SECOND_LONG 1,1
#define BIT_1_IN_SECOND_LONG 1,2

#define HAS_BIT(x,y) long_array[x]&y

main()
{
   long long_array[2];

   if(HAS_BIT(BIT_0_IN_FIRST_LONG)) foo();
   if(HAS_BIT(BIT_1_IN_SECOND_LONG)) bar();
   if(HAS_BIT(BIT_1_IN_FIRST_LONG)) baz();
}

You get the idea...

 _/\_   GU -d H s : g? p5 au- a17 w v- C UL P L 3- E---- N K- W--- M-- V-- po
/ L  \  Y t 5 j-- R G---- tv-- b D B--- e u*(**) h! f !r !n !y+   
\_ C_/  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  \/    My life as an instruction: xchg   al,al

Most people wouldn't know music if it came up and bit them on the ass.
		-- Frank Zappa



This archive was generated by hypermail 2b30 : 12/18/00 PST