Go to the documentation of this file.
13 #ifndef _XTENSA_BITOPS_H
14 #define _XTENSA_BITOPS_H
18 #ifndef _LINUX_BITOPS_H
19 #error only <linux/bitops.h> can be included directly
22 #include <asm/processor.h>
23 #include <asm/byteorder.h>
26 # error SMP not supported on this architecture
29 #define smp_mb__before_clear_bit() barrier()
30 #define smp_mb__after_clear_bit() barrier()
37 static inline unsigned long __cntlz (
unsigned long x)
40 asm (
"nsau %0, %1" :
"=r" (lz) :
"r" (x));
49 static inline int ffz(
unsigned long x)
51 return 31 - __cntlz(~x & -~x);
58 static inline int __ffs(
unsigned long x)
60 return 31 - __cntlz(x & -x);
69 static inline int ffs(
unsigned long x)
71 return 32 - __cntlz(x & -x);
79 static inline int fls (
unsigned int x)
81 return 32 - __cntlz(x);
90 static inline unsigned long __fls(
unsigned long word)
92 return 31 - __cntlz(word);