On Aug 16, 2005, at 6:07 PM, Bob Paddock wrote:

You can test to make sure that you do have a power of two buffer size with the
following:

#define myQ_SIZE    64

#define myQ_MASK ( myQ__SIZE - 1 )
#if ( myQ__SIZE & myQ__MASK )
 #error myQ_SIZE buffer size is not a power of 2
#endif

Wouldn't it be easier to simply define the size like this:

#define myQ_SIZE    (1<<6)

If you shift a 1 then it must be a power of 2.

--
David Kelly N4HHE, [EMAIL PROTECTED]
========================================================================
Whom computers would destroy, they must first drive mad.



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to