18 #define RRR (1<<logRRR)
24 #define UNUSED __attribute__((unused))
29 #ifdef HAS_NATIVE_POPCOUNT
30 static inline UNUSED unsigned int popcount(unsigned int n){
31 return __builtin_popcount(n);
34 static inline UNUSED unsigned int popcount8(unsigned int n) {
35 return popcount(n & 0xff);
39 #ifdef HAS_POPCOUNT_TABLE
41 extern unsigned char popCount[256];
43 static UNUSED unsigned int popcount8(unsigned int x)
45 return (unsigned int) popCount[x & 0xff];
48 static UNUSED unsigned int popcount(unsigned int x)
52 popcount8((x >> 16)) +
58 static UNUSED unsigned int popcount8(unsigned int x)
62 r = ((r & 0xaa)>>1) + (r & 0x55);
63 r = ((r & 0xcc)>>2) + (r & 0x33);
64 r = ((r>>4) + r) & 0x0f;
68 static inline UNUSED unsigned int popcount(unsigned int x)
70 unsigned int m1 = 0x55555555;
71 unsigned int m2 = 0xc30c30c3;
73 x = (x & m2) + ((x >> 2) & m2) + ((x >> 4) & m2);
75 return (x + (x >> 12) + (x >> 24)) & 0x3f;
82 void * bp_malloc(size_t);
84 #define bp_xmalloc(p, n) p = (__typeof__(p)) bp_malloc((n)*sizeof(*p))
90 size_t bp_get_alloc_stats(void);
92 void bp_reset_alloc_states(void);
94 int bp_setbit(unsigned int *B, int i,int x);
96 int bp_setbits(unsigned int *B, int i, int d, int x);
98 static inline int bp_getbit(unsigned int *B, int i)
102 return (B[j] >> (D-1-l)) & 1;