xref: /OK3568_Linux_fs/kernel/include/asm-generic/bitops/builtin-__ffs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
3*4882a593Smuzhiyun #define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /**
6*4882a593Smuzhiyun  * __ffs - find first bit in word.
7*4882a593Smuzhiyun  * @word: The word to search
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * Undefined if no bit exists, so code should check against 0 first.
10*4882a593Smuzhiyun  */
__ffs(unsigned long word)11*4882a593Smuzhiyun static __always_inline unsigned long __ffs(unsigned long word)
12*4882a593Smuzhiyun {
13*4882a593Smuzhiyun 	return __builtin_ctzl(word);
14*4882a593Smuzhiyun }
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #endif
17