change the type of popcount unsigned
authorYAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Mon, 22 Apr 2013 13:20:08 +0000 (22:20 +0900)
committerBen Pfaff <blp@nicira.com>
Mon, 22 Apr 2013 15:51:22 +0000 (08:51 -0700)
it's a natural choice and compatible with a version found in NetBSD libc.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/util.c
lib/util.h

index cbaffa7..cd4019e 100644 (file)
@@ -843,7 +843,7 @@ raw_ctz(uint32_t n)
 #endif
 
 /* Returns the number of 1-bits in 'x', between 0 and 32 inclusive. */
-int
+unsigned int
 popcount(uint32_t x)
 {
     /* In my testing, this implementation is over twice as fast as any other
index b944ec7..4f6a201 100644 (file)
@@ -265,7 +265,7 @@ ctz(uint32_t n)
 
 int log_2_floor(uint32_t);
 int log_2_ceil(uint32_t);
-int popcount(uint32_t);
+unsigned int popcount(uint32_t);
 
 /* Returns the rightmost 1-bit in 'x' (e.g. 01011000 => 00001000), or 0 if 'x'
  * is 0. */