X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Futil.h;h=4f8a29100608e73e8eb405deb7c03a7db2c73e05;hb=d578065e7d9dd70ca6a81ddbc5e4ecb763d1152e;hp=fbab74c9c8a90dce8a5072904f15341fa1e5c3ea;hpb=780ec6aea9f2c664953c3c84468d77f6daf53925;p=sliver-openvswitch.git diff --git a/lib/util.h b/lib/util.h index fbab74c9c..4f8a29100 100644 --- a/lib/util.h +++ b/lib/util.h @@ -325,7 +325,7 @@ int raw_ctz(uint64_t n); /* Returns the number of trailing 0-bits in 'n', or 32 if 'n' is 0. */ static inline int -ctz(uint32_t n) +ctz32(uint32_t n) { return n ? raw_ctz(n) : 32; } @@ -361,10 +361,10 @@ zero_rightmost_1bit(uintmax_t x) static inline uint32_t rightmost_1bit_idx(uint32_t x) { - return x ? ctz(x) : 32; + return ctz32(x); } -/* Returns the index of the rightmost 1-bit in 'x' (e.g. 01011000 => 6), or 32 +/* Returns the index of the leftmost 1-bit in 'x' (e.g. 01011000 => 6), or 32 * if 'x' is 0. * * This function only works with 32-bit integers. */