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 asm ("popcnt %1, %0" : "=r" (n) : "0" (n));
35 static inline UNUSED unsigned int popcount8(unsigned int n) {
36 return popcount(n & 0xff);
40 #ifdef HAS_POPCOUNT_TABLE
42 extern unsigned char popCount[256];
44 static UNUSED unsigned int popcount8(unsigned int x)
46 return (unsigned int) popCount[x & 0xff];
49 static UNUSED unsigned int popcount(unsigned int x)
53 popcount8((x >> 16)) +
59 static UNUSED unsigned int popcount8(unsigned int x)
63 r = ((r & 0xaa)>>1) + (r & 0x55);
64 r = ((r & 0xcc)>>2) + (r & 0x33);
65 r = ((r>>4) + r) & 0x0f;
69 static inline UNUSED unsigned int popcount(unsigned int x)
71 unsigned int m1 = 0x55555555;
72 unsigned int m2 = 0xc30c30c3;
74 x = (x & m2) + ((x >> 2) & m2) + ((x >> 4) & m2);
76 return (x + (x >> 12) + (x >> 24)) & 0x3f;
83 void * bp_malloc(size_t);
85 #define bp_xmalloc(p, n) p = (__typeof__(p)) bp_malloc((n)*sizeof(*p))
91 size_t bp_get_alloc_stats(void);
93 void bp_reset_alloc_states(void);
95 int bp_setbit(unsigned int *B, int i,int x);
97 int bp_setbits(unsigned int *B, int i, int d, int x);
99 static inline int bp_getbit(unsigned int *B, int i)
103 return (B[j] >> (D-1-l)) & 1;