X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Flibbp.git;a=blobdiff_plain;f=utils.h;fp=utils.h;h=0000000000000000000000000000000000000000;hp=0d5eed8d51511425abc394b38e9b303781d6376f;hb=45ff7a2260f890f6ef6a7b56f654ffa1a057a7e7;hpb=b3b328570c63aea4d9d15854eec9f7434cc9fe0d diff --git a/utils.h b/utils.h deleted file mode 100644 index 0d5eed8..0000000 --- a/utils.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef UTILS_H_ -#define UTILS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef HAS_NATIVE_POPCOUNT -static inline unsigned int popcount(pb n){ - asm ("popcnt %1, %0" : "=r" (n) : "0" (n)); - return n; -} - -static inline unsigned int popcount8(pb n) { - return popcount(n & 0xff); -} - -#else - -static unsigned int popcount8(pb x) -{ - dword r; - r = x; - r = ((r & 0xaa)>>1) + (r & 0x55); - r = ((r & 0xcc)>>2) + (r & 0x33); - r = ((r>>4) + r) & 0x0f; - return r; -} - -static inline unsigned int -popcount(pb x) -{ - uint m1 = 0x55555555; - uint m2 = 0xc30c30c3; - x -= (x >> 1) & m1; - x = (x & m2) + ((x >> 2) & m2) + ((x >> 4) & m2); - x += x >> 6; - return (x + (x >> 12) + (x >> 24)) & 0x3f; -} - -#endif - -#ifdef __cplusplus - } -#endif - - -#endif