lib/util: More portable use of builtin popcnt.
authorJarno Rajahalme <jrajahalme@nicira.com>
Thu, 12 Dec 2013 16:27:41 +0000 (08:27 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Thu, 12 Dec 2013 16:27:41 +0000 (08:27 -0800)
commit381657b3ea69ea50c1dd43588f795fa7a0459ecb
tree91e77b598c8967a28af3cc665d920aff52758577
parent4abb8608afb4000726adf9e3a09da26874880fe3
lib/util: More portable use of builtin popcnt.

- Use the GCC predefined macro __POPCNT__ to detect the availability
  of fast __builtin_popcnt function.
- Use portable preprocessor macros to detect 64-bit build.
- Only define the 32-bit parts when needed and declare the
  count_1bits_8 at file scope to silence a warning.

This time I have tested all code paths to make sure no warnigns are
generated.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
lib/util.c
lib/util.h