diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-01-03 16:21:08 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-01-03 16:21:08 +1030 |
commit | 5ece5c5192d065c229da01e7b347c1d3877b59fa (patch) | |
tree | 755642823b24f869c4c67c7712f6fa45c4f87e9d /include | |
parent | 5c134dad43443aa9c9606eaf47c378a6b9c5c597 (diff) | |
download | op-kernel-dev-5ece5c5192d065c229da01e7b347c1d3877b59fa.zip op-kernel-dev-5ece5c5192d065c229da01e7b347c1d3877b59fa.tar.gz |
xtensa: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-xtensa/bitops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index 23261e8..6c39303 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h @@ -82,6 +82,16 @@ static inline int fls (unsigned int x) return 32 - __cntlz(x); } +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static inline unsigned long __fls(unsigned long word) +{ + return 31 - __cntlz(word); +} #else /* Use the generic implementation if we don't have the nsa/nsau instructions. */ @@ -90,6 +100,7 @@ static inline int fls (unsigned int x) # include <asm-generic/bitops/__ffs.h> # include <asm-generic/bitops/ffz.h> # include <asm-generic/bitops/fls.h> +# include <asm-generic/bitops/__fls.h> #endif |