On Wed, Aug 13, 2014 at 6:40 PM, Harold Hallikainen wrote: > It'd be interesting to experiment with it. The advantage to the shifting > of the bit number instead of the variable is that it can be done at > compile time instead of run time. A couple possibilities come to mind... > > Try just doing 1<<23 and see if you get the right result. Perhaps the > macro arithmetic is not handling that large an int. The compiler was actually spitting out a warning, but it scrolled by so quickly I was missing it. It was throwing: "warning: (753) undefined shift (23 bits)". So evidently it didn't like things being that high. Bob's solution of forcing 1 to get created as a long fixed this. > I'm not sure of the exact operation of ! when the following item is not 0 > or 1. Perhaps a compare to zero can be included in your macro. Also, on > naming, testbit does not clearly indicate to me whether it returns true i= f > the bit is high or low. It says we test the bit, but does not tell us muc= h > about the result. > > So, how about this (untested) code? > > #define BithHigh(var, bit) (0!=3D(var & (1 <