X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Flibbp.git;a=blobdiff_plain;f=bp-utils.h;fp=bp-utils.h;h=56f2d736fca9232160e27039ffbf59d755a66069;hp=21aa7d3f31127cdfc4f6ba8a2ac079ef3f0754fa;hb=5382b5fde5add82ebd492e97a458a824503fbd8d;hpb=35d38c5681c54a22125452a2e43dc4b8305c588f diff --git a/bp-utils.h b/bp-utils.h index 21aa7d3..56f2d73 100644 --- a/bp-utils.h +++ b/bp-utils.h @@ -18,20 +18,21 @@ extern "C" { #define RRR (1< - +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif #ifdef HAS_NATIVE_POPCOUNT -static inline unsigned int popcount(unsigned int n){ +static inline UNUSED unsigned int popcount(unsigned int n){ asm ("popcnt %1, %0" : "=r" (n) : "0" (n)); return n; } -static inline unsigned int popcount8(unsigned int n) { +static inline UNUSED unsigned int popcount8(unsigned int n) { return popcount(n & 0xff); } @@ -40,12 +41,12 @@ static inline unsigned int popcount8(unsigned int n) { extern unsigned char popCount[256]; -static unsigned int popcount8(unsigned int x) +static UNUSED unsigned int popcount8(unsigned int x) { return (unsigned int) popCount[x & 0xff]; } -static unsigned int popcount(unsigned int x) +static UNUSED unsigned int popcount(unsigned int x) { return popcount8(x) + popcount8((x >> 8)) + @@ -55,7 +56,7 @@ static unsigned int popcount(unsigned int x) #else -static unsigned int popcount8(unsigned int x) +static UNUSED unsigned int popcount8(unsigned int x) { unsigned int r; r = x; @@ -65,7 +66,7 @@ static unsigned int popcount8(unsigned int x) return r; } -static inline unsigned int popcount(unsigned int x) +static inline UNUSED unsigned int popcount(unsigned int x) { unsigned int m1 = 0x55555555; unsigned int m2 = 0xc30c30c3;