Change-Id: Id02d613b8613a2d448840fe2d6a5e3b168a3c563
Signed-off-by: Damjan Marion <damarion@cisco.com>
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;
#endif
return x & (2 * BITS (uword) - 1);
+#endif
}
/* Based on "Hacker's Delight" code from GLS. */