1 #ifndef _ASM_GENERIC_BITOPS___FLS_H_
2 #define _ASM_GENERIC_BITOPS___FLS_H_
7 * __fls - find last (most-significant) set bit in a long word
8 * @word: the word to search
10 * Undefined if no set bit exists, so code should check against 0 first.
12 static __always_inline
unsigned long __fls(unsigned long word
)
14 int num
= BITS_PER_LONG
- 1;
16 #if BITS_PER_LONG == 64
17 if (!(word
& (~0ul << 32))) {
22 if (!(word
& (~0ul << (BITS_PER_LONG
-16)))) {
26 if (!(word
& (~0ul << (BITS_PER_LONG
-8)))) {
30 if (!(word
& (~0ul << (BITS_PER_LONG
-4)))) {
34 if (!(word
& (~0ul << (BITS_PER_LONG
-2)))) {
38 if (!(word
& (~0ul << (BITS_PER_LONG
-1))))
43 #endif /* _ASM_GENERIC_BITOPS___FLS_H_ */