1 #ifndef _LINUX_BITOPS_H
2 #define _LINUX_BITOPS_H
6 * Include this here because some architectures need generic_ffs/fls in
9 #include <asm/bitops.h>
11 static __inline__
int get_bitmask_order(unsigned int count
)
16 return order
; /* We could be slightly more clever with -1 here... */
19 static __inline__
int get_count_order(unsigned int count
)
23 order
= fls(count
) - 1;
24 if (count
& (count
- 1))
29 static inline unsigned long hweight_long(unsigned long w
)
31 return sizeof(w
) == 4 ? hweight32(w
) : hweight64(w
);
35 * rol32 - rotate a 32-bit value left
36 * @word: value to rotate
37 * @shift: bits to roll
39 static inline __u32
rol32(__u32 word
, unsigned int shift
)
41 return (word
<< shift
) | (word
>> (32 - shift
));
45 * ror32 - rotate a 32-bit value right
46 * @word: value to rotate
47 * @shift: bits to roll
49 static inline __u32
ror32(__u32 word
, unsigned int shift
)
51 return (word
>> shift
) | (word
<< (32 - shift
));
54 static inline unsigned fls_long(unsigned long l
)