Signed-off-by: Lai Jiangshan <[email protected]>
---
 rculfhash.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/rculfhash.c b/rculfhash.c
index 7b880d7..eca3a4e 100644
--- a/rculfhash.c
+++ b/rculfhash.c
@@ -445,24 +445,22 @@ unsigned int fls_ulong(unsigned long x)
 #endif
 }
 
+/* find the minimum order that x <= (1UL << order) */
 int get_count_order_u32(uint32_t x)
 {
-       int order;
+       if (!x)
+               return -1;
 
-       order = fls_u32(x) - 1;
-       if (x & (x - 1))
-               order++;
-       return order;
+       return fls_u32(x - 1);
 }
 
+/* find the minimum order that x <= (1UL << order) */
 int get_count_order_ulong(unsigned long x)
 {
-       int order;
+       if (!x)
+               return -1;
 
-       order = fls_ulong(x) - 1;
-       if (x & (x - 1))
-               order++;
-       return order;
+       return fls_ulong(x - 1);
 }
 
 #ifdef POISON_FREE
-- 
1.7.4.4


_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to