/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_SH_BITOPS_H #define __ASM_SH_BITOPS_H #ifndef _LINUX_BITOPS_H #error only can be included directly #endif /* For __swab32 */ #include #include #ifdef CONFIG_GUSA_RB #include #elif defined(CONFIG_CPU_SH2A) #include #include #elif defined(CONFIG_CPU_SH4A) #include #elif defined(CONFIG_CPU_J2) && defined(CONFIG_SMP) #include #else #include #include #endif static inline unsigned long ffz(unsigned long word) { unsigned long result; __asm__("1:\n\t" "shlr %1\n\t" "bt/s 1b\n\t" " add #1, %0" : "=r" (result), "=r" (word) : "0" (~0L), "1" (word) : "t"); return result; } /** * __ffs - find first bit in word. * @word: The word to search * * Undefined if no bit exists, so code should check against 0 first. */ static inline unsigned long __ffs(unsigned long word) { unsigned long result; __asm__("1:\n\t" "shlr %1\n\t" "bf/s 1b\n\t" " add #1, %0" : "=r" (result), "=r" (word) : "0" (~0L), "1" (word) : "t"); return result; } #include #include #include #include #include #include #include #include #include #endif /* __ASM_SH_BITOPS_H */