16 #ifndef _ASM_TILE_BITOPS_H
17 #define _ASM_TILE_BITOPS_H
19 #include <linux/types.h>
21 #ifndef _LINUX_BITOPS_H
22 #error only <linux/bitops.h> can be included directly
26 #include <asm/bitops_64.h>
28 #include <asm/bitops_32.h>
37 static inline unsigned long __ffs(
unsigned long word)
39 return __builtin_ctzl(word);
48 static inline unsigned long ffz(
unsigned long word)
50 return __builtin_ctzl(~word);
59 static inline unsigned long __fls(
unsigned long word)
61 return (
sizeof(word) * 8) - 1 - __builtin_clzl(word);
75 static inline int ffs(
int x)
77 return __builtin_ffs(x);
80 static inline int fls64(
__u64 w)
82 return (
sizeof(
__u64) * 8) - __builtin_clzll(w);
96 static inline int fls(
int x)
98 return fls64((
unsigned int) x);
101 static inline unsigned int __arch_hweight32(
unsigned int w)
103 return __builtin_popcount(w);
106 static inline unsigned int __arch_hweight16(
unsigned int w)
108 return __builtin_popcount(w & 0xffff);
111 static inline unsigned int __arch_hweight8(
unsigned int w)
113 return __builtin_popcount(w & 0xff);
116 static inline unsigned long __arch_hweight64(
__u64 w)
118 return __builtin_popcountll(w);