bithacks.h File Reference

Go to the source code of this file.

Defines

#define HEXIFY(x)   0x##x##LU
#define B8IFY(x)
#define B8(x)   ((unsigned char)B8IFY(HEXIFY(x)))
#define B_EVEN(x)   (((x)&1)==0)
#define B_ODD(x)   (!B_EVEN((x)))
#define B_IS_SET(x, n)   (((x) & (1<<(n)))?1:0)
#define B_SET(x, n)   ((x) |= (1<<(n)))
#define B_UNSET(x, n)   ((x) &= ~(1<<(n)))
#define B_TOGGLE(x, n)   ((x) ^= (1<<(n)))
#define B_TURNOFF_1(x)   ((x) &= ((x)-1))
#define B_ISOLATE_1(x)   ((x) &= (-(x)))
#define B_PROPAGATE_1(x)   ((x) |= ((x)-1))
#define B_ISOLATE_0(x)   ((x) = ~x & ((x)+1))
#define B_TURNON_0(x)   ((x) |= ((x)+1))

Define Documentation

#define B8 (  )     ((unsigned char)B8IFY(HEXIFY(x)))

Definition at line 27 of file bithacks.h.

#define B8IFY (  ) 
Value:
(((x&0x0000000FLU)?1:0)  + \
                  ((x&0x000000F0LU)?2:0)  + \
                  ((x&0x00000F00LU)?4:0)  + \
                  ((x&0x0000F000LU)?8:0)  + \
                  ((x&0x000F0000LU)?16:0) + \
                  ((x&0x00F00000LU)?32:0) + \
                  ((x&0x0F000000LU)?64:0) + \
                  ((x&0xF0000000LU)?128:0))

Definition at line 18 of file bithacks.h.

#define B_EVEN (  )     (((x)&1)==0)

Definition at line 36 of file bithacks.h.

#define B_IS_SET ( x,
 )     (((x) & (1<<(n)))?1:0)

Definition at line 42 of file bithacks.h.

#define B_ISOLATE_0 (  )     ((x) = ~x & ((x)+1))

Definition at line 63 of file bithacks.h.

#define B_ISOLATE_1 (  )     ((x) &= (-(x)))

Definition at line 57 of file bithacks.h.

#define B_ODD (  )     (!B_EVEN((x)))

Definition at line 39 of file bithacks.h.

#define B_PROPAGATE_1 (  )     ((x) |= ((x)-1))

Definition at line 60 of file bithacks.h.

#define B_SET ( x,
 )     ((x) |= (1<<(n)))

Definition at line 45 of file bithacks.h.

#define B_TOGGLE ( x,
 )     ((x) ^= (1<<(n)))

Definition at line 51 of file bithacks.h.

#define B_TURNOFF_1 (  )     ((x) &= ((x)-1))

Definition at line 54 of file bithacks.h.

#define B_TURNON_0 (  )     ((x) |= ((x)+1))

Definition at line 66 of file bithacks.h.

#define B_UNSET ( x,
 )     ((x) &= ~(1<<(n)))

Definition at line 48 of file bithacks.h.

#define HEXIFY (  )     0x##x##LU

Definition at line 16 of file bithacks.h.


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:57 2011 by Doxygen 1.6.1