18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
38c2ecf20Sopenharmony_ci#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/**
68c2ecf20Sopenharmony_ci * __ffs - find first bit in word.
78c2ecf20Sopenharmony_ci * @word: The word to search
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Undefined if no bit exists, so code should check against 0 first.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_cistatic __always_inline unsigned long __ffs(unsigned long word)
128c2ecf20Sopenharmony_ci{
138c2ecf20Sopenharmony_ci	return __builtin_ctzl(word);
148c2ecf20Sopenharmony_ci}
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#endif
17