1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_
3 #define _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_
6 #include <asm/bitsperlong.h>
9 * __ffs - find first bit in word.
10 * @word: The word to search
12 * Undefined if no bit exists, so code should check against 0 first.
14 static __always_inline
unsigned long __ffs(unsigned long word
)
18 #if __BITS_PER_LONG == 64
19 if ((word
& 0xffffffff) == 0) {
24 if ((word
& 0xffff) == 0) {
28 if ((word
& 0xff) == 0) {
32 if ((word
& 0xf) == 0) {
36 if ((word
& 0x3) == 0) {
40 if ((word
& 0x1) == 0)
45 #endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_ */