changeset 3812 | d9b3041ee3d0 |
parent 3352 | 49d580a11385 |
child 3941 | 34116fc17887 |
--- a/macros.h Thu May 11 09:54:11 2006 +0000 +++ b/macros.h Thu May 11 10:33:58 2006 +0000 @@ -117,6 +117,9 @@ } } +/** returns true if value a has only one bit set to 1 */ +#define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0) + /* [min,max), strictly less than */ #define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min))) #define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))