diff options
-rw-r--r-- | include/asm-generic/bitops/const_hweight.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h index fa2a50b7ee66..0a7e06623470 100644 --- a/include/asm-generic/bitops/const_hweight.h +++ b/include/asm-generic/bitops/const_hweight.h | |||
@@ -5,14 +5,15 @@ | |||
5 | * Compile time versions of __arch_hweightN() | 5 | * Compile time versions of __arch_hweightN() |
6 | */ | 6 | */ |
7 | #define __const_hweight8(w) \ | 7 | #define __const_hweight8(w) \ |
8 | ( (!!((w) & (1ULL << 0))) + \ | 8 | ((unsigned int) \ |
9 | (!!((w) & (1ULL << 1))) + \ | 9 | ((!!((w) & (1ULL << 0))) + \ |
10 | (!!((w) & (1ULL << 2))) + \ | 10 | (!!((w) & (1ULL << 1))) + \ |
11 | (!!((w) & (1ULL << 3))) + \ | 11 | (!!((w) & (1ULL << 2))) + \ |
12 | (!!((w) & (1ULL << 4))) + \ | 12 | (!!((w) & (1ULL << 3))) + \ |
13 | (!!((w) & (1ULL << 5))) + \ | 13 | (!!((w) & (1ULL << 4))) + \ |
14 | (!!((w) & (1ULL << 6))) + \ | 14 | (!!((w) & (1ULL << 5))) + \ |
15 | (!!((w) & (1ULL << 7))) ) | 15 | (!!((w) & (1ULL << 6))) + \ |
16 | (!!((w) & (1ULL << 7))))) | ||
16 | 17 | ||
17 | #define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 )) | 18 | #define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 )) |
18 | #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16)) | 19 | #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16)) |