diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 19:56:02 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 19:56:02 -0800 |
commit | 4060994c3e337b40e0f6fa8ce2cc178e021baf3d (patch) | |
tree | 980297c1747ca89354bc879cc5d17903eacb19e2 /include/linux/bitops.h | |
parent | 0174f72f848dfe7dc7488799776303c81b181b16 (diff) | |
parent | d3ee871e63d0a0c70413dc0aa5534b8d6cd6ec37 (diff) | |
download | op-kernel-dev-4060994c3e337b40e0f6fa8ce2cc178e021baf3d.zip op-kernel-dev-4060994c3e337b40e0f6fa8ce2cc178e021baf3d.tar.gz |
Merge x86-64 update from Andi
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index cb3c3ef..38c2fb7 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -84,6 +84,16 @@ static __inline__ int get_bitmask_order(unsigned int count) return order; /* We could be slightly more clever with -1 here... */ } +static __inline__ int get_count_order(unsigned int count) +{ + int order; + + order = fls(count) - 1; + if (count & (count - 1)) + order++; + return order; +} + /* * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word |