Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix undefined symbol: fformat_append_cr in vat plugins loading
[vpp.git]
/
src
/
vppinfra
/
bitops.h
diff --git
a/src/vppinfra/bitops.h
b/src/vppinfra/bitops.h
index
ab91b8a
..
17ad49f
100644
(file)
--- a/
src/vppinfra/bitops.h
+++ b/
src/vppinfra/bitops.h
@@
-44,6
+44,13
@@
always_inline uword
count_set_bits (uword x)
{
always_inline uword
count_set_bits (uword x)
{
+#ifdef __POPCNT__
+#if uword_bits == 64
+ return __builtin_popcountll (x);
+#else
+ return __builtin_popcount (x);
+#endif
+#else
#if uword_bits == 64
const uword c1 = 0x5555555555555555;
const uword c2 = 0x3333333333333333;
#if uword_bits == 64
const uword c1 = 0x5555555555555555;
const uword c2 = 0x3333333333333333;
@@
-71,6
+78,7
@@
count_set_bits (uword x)
#endif
return x & (2 * BITS (uword) - 1);
#endif
return x & (2 * BITS (uword) - 1);
+#endif
}
/* Based on "Hacker's Delight" code from GLS. */
}
/* Based on "Hacker's Delight" code from GLS. */