[ovs-dev] [PATCH 08/18] change the type of popcount unsigned.

YAMAMOTO Takashi yamamoto at valinux.co.jp
Thu Jan 31 10:49:42 UTC 2013


From: YAMAMOTO Takashi <yamt at mwd.biglobe.ne.jp>

it's a natural choice and compatible with a version found in NetBSD libc.

Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
---
 lib/util.c | 2 +-
 lib/util.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/util.c b/lib/util.c
index 83d3ff8..8a0b3ab 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -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
diff --git a/lib/util.h b/lib/util.h
index b944ec7..4f6a201 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -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. */
-- 
1.7.12




More information about the dev mailing list