util: Make popcount() handle 64-bit integers, not separate popcount64().
authorBen Pfaff <blp@nicira.com>
Mon, 18 Nov 2013 21:18:41 +0000 (13:18 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 18 Nov 2013 22:35:53 +0000 (14:35 -0800)
commit2a4ca27c2659dbe5b07f7c1faa301bce17704ec3
tree652ecf61f7c136954c99ca62941ac3ee03e5d074
parentd43d314e62b9791d1b9c13595a13fd6a851f856e
util: Make popcount() handle 64-bit integers, not separate popcount64().

Having a single function that can do popcount() on any integer type is
easier for callers to get right.  The implementation is probably slower
if the caller actually provides a 32-bit (or shorter) integer, but the
only existing callers always provide a full 64-bit integer so this seems
unimportant for now.

This also restores use, in practice, of the optimized implementation of
population count.  (As the comment on popcount32() says, this version is
2x faster than __builtin_popcount().)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/flow.c
lib/util.c
lib/util.h
tests/test-util.c