projects
/
SXSI
/
libbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Silence a printf warning for %lu on 32bits archs.
[SXSI/libbp.git]
/
bp-utils.h
diff --git
a/bp-utils.h
b/bp-utils.h
index
21aa7d3
..
2397d6f
100644
(file)
--- a/
bp-utils.h
+++ b/
bp-utils.h
@@
-18,20
+18,20
@@
extern "C" {
#define RRR (1<<logRRR)
#define RRR (1<<logRRR)
-
-
-
#include <stdlib.h>
#include <stdlib.h>
-
+#ifdef __GNUC__
+#define UNUSED __attribute__((unused))
+#else
+#define UNUSED
+#endif
#ifdef HAS_NATIVE_POPCOUNT
#ifdef HAS_NATIVE_POPCOUNT
-static inline unsigned int popcount(unsigned int n){
- asm ("popcnt %1, %0" : "=r" (n) : "0" (n));
- return n;
+static inline UNUSED unsigned int popcount(unsigned int n){
+ return __builtin_popcount(n);
}
}
-static inline unsigned int popcount8(unsigned int n) {
+static inline
UNUSED
unsigned int popcount8(unsigned int n) {
return popcount(n & 0xff);
}
return popcount(n & 0xff);
}
@@
-40,12
+40,12
@@
static inline unsigned int popcount8(unsigned int n) {
extern unsigned char popCount[256];
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];
}
{
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)) +
{
return popcount8(x) +
popcount8((x >> 8)) +
@@
-55,7
+55,7
@@
static unsigned int popcount(unsigned int x)
#else
#else
-static unsigned int popcount8(unsigned int x)
+static
UNUSED
unsigned int popcount8(unsigned int x)
{
unsigned int r;
r = x;
{
unsigned int r;
r = x;
@@
-65,7
+65,7
@@
static unsigned int popcount8(unsigned int x)
return r;
}
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;
{
unsigned int m1 = 0x55555555;
unsigned int m2 = 0xc30c30c3;