Linux 3.15-rc1
[linux/fpc-iii.git] / arch / mips / include / asm / arch_hweight.h
blob712a7445ee93a11082afb9e781e4393296b1ec3b
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 */
7 #ifndef _ASM_ARCH_HWEIGHT_H
8 #define _ASM_ARCH_HWEIGHT_H
10 #ifdef ARCH_HAS_USABLE_BUILTIN_POPCOUNT
12 #include <asm/types.h>
14 static inline unsigned int __arch_hweight32(unsigned int w)
16 return __builtin_popcount(w);
19 static inline unsigned int __arch_hweight16(unsigned int w)
21 return __builtin_popcount(w & 0xffff);
24 static inline unsigned int __arch_hweight8(unsigned int w)
26 return __builtin_popcount(w & 0xff);
29 static inline unsigned long __arch_hweight64(__u64 w)
31 return __builtin_popcountll(w);
34 #else
35 #include <asm-generic/bitops/arch_hweight.h>
36 #endif
38 #endif /* _ASM_ARCH_HWEIGHT_H */