18 #define RRR (1<<logRRR)
28 #ifdef HAS_NATIVE_POPCOUNT
29 static inline unsigned int popcount(unsigned int n){
30 asm ("popcnt %1, %0" : "=r" (n) : "0" (n));
34 static inline unsigned int popcount8(unsigned int n) {
35 return popcount(n & 0xff);
40 static unsigned int popcount8(unsigned int x)
44 r = ((r & 0xaa)>>1) + (r & 0x55);
45 r = ((r & 0xcc)>>2) + (r & 0x33);
46 r = ((r>>4) + r) & 0x0f;
50 static inline unsigned int popcount(unsigned int x)
52 unsigned int m1 = 0x55555555;
53 unsigned int m2 = 0xc30c30c3;
55 x = (x & m2) + ((x >> 2) & m2) + ((x >> 4) & m2);
57 return (x + (x >> 12) + (x >> 24)) & 0x3f;
63 void * bp_malloc(size_t);
65 #define bp_xmalloc(p, n) p = (__typeof__(p)) bp_malloc((n)*sizeof(*p))
71 size_t bp_alloc_stats(void);
73 void bp_reset_alloc_states(void);
75 int bp_setbit(unsigned int *B, int i,int x);
77 int bp_setbits(unsigned int *B, int i, int d, int x);
79 static inline int bp_getbit(unsigned int *B, int i)
83 return (B[j] >> (D-1-l)) & 1;