diff options
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index b79389879238..c55d5bc4ee58 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -47,31 +47,6 @@ static inline unsigned long hweight_long(unsigned long w) | |||
47 | return sizeof(w) == 4 ? hweight32(w) : hweight64(w); | 47 | return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
48 | } | 48 | } |
49 | 49 | ||
50 | /* | ||
51 | * Clearly slow versions of the hweightN() functions, their benefit is | ||
52 | * of course compile time evaluation of constant arguments. | ||
53 | */ | ||
54 | #define HWEIGHT8(w) \ | ||
55 | ( BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + \ | ||
56 | (!!((w) & (1ULL << 0))) + \ | ||
57 | (!!((w) & (1ULL << 1))) + \ | ||
58 | (!!((w) & (1ULL << 2))) + \ | ||
59 | (!!((w) & (1ULL << 3))) + \ | ||
60 | (!!((w) & (1ULL << 4))) + \ | ||
61 | (!!((w) & (1ULL << 5))) + \ | ||
62 | (!!((w) & (1ULL << 6))) + \ | ||
63 | (!!((w) & (1ULL << 7))) ) | ||
64 | |||
65 | #define HWEIGHT16(w) (HWEIGHT8(w) + HWEIGHT8((w) >> 8)) | ||
66 | #define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16)) | ||
67 | #define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32)) | ||
68 | |||
69 | /* | ||
70 | * Type invariant version that simply casts things to the | ||
71 | * largest type. | ||
72 | */ | ||
73 | #define HWEIGHT(w) HWEIGHT64((u64)(w)) | ||
74 | |||
75 | /** | 50 | /** |
76 | * rol32 - rotate a 32-bit value left | 51 | * rol32 - rotate a 32-bit value left |
77 | * @word: value to rotate | 52 | * @word: value to rotate |