macros.h
changeset 3132 724ede39bda9
parent 2966 7f382cfeb93d
child 3326 b5ce3e805425
equal deleted inserted replaced
3131:e856656f99a9 3132:724ede39bda9
    55 /* OPT: optimized into an unsigned comparison */
    55 /* OPT: optimized into an unsigned comparison */
    56 //#define IS_INSIDE_1D(x, base, size) ((x) >= (base) && (x) < (base) + (size))
    56 //#define IS_INSIDE_1D(x, base, size) ((x) >= (base) && (x) < (base) + (size))
    57 #define IS_INSIDE_1D(x, base, size) ( (uint)((x) - (base)) < ((uint)(size)) )
    57 #define IS_INSIDE_1D(x, base, size) ( (uint)((x) - (base)) < ((uint)(size)) )
    58 
    58 
    59 
    59 
    60 #define HASBIT(x,y)    ((x) &   (1 << (y)))
    60 #define HASBIT(x,y)    (((x) & (1 << (y))) != 0)
    61 #define SETBIT(x,y)    ((x) |=  (1 << (y)))
    61 #define SETBIT(x,y)    ((x) |=  (1 << (y)))
    62 #define CLRBIT(x,y)    ((x) &= ~(1 << (y)))
    62 #define CLRBIT(x,y)    ((x) &= ~(1 << (y)))
    63 #define TOGGLEBIT(x,y) ((x) ^=  (1 << (y)))
    63 #define TOGGLEBIT(x,y) ((x) ^=  (1 << (y)))
    64 
    64 
    65 // checking more bits. Maybe unneccessary, but easy to use
    65 // checking more bits. Maybe unneccessary, but easy to use