diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bitops.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 48f87b979ca9..7d1f8b67c6bf 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -134,4 +134,26 @@ static inline unsigned long hweight_long(unsigned long w) return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); } +/* + * rol32 - rotate a 32-bit value left + * + * @word: value to rotate + * @shift: bits to roll + */ +static inline __u32 rol32(__u32 word, int shift) +{ + return (word << shift) | (word >> (32 - shift)); +} + +/* + * ror32 - rotate a 32-bit value right + * + * @word: value to rotate + * @shift: bits to roll + */ +static inline __u32 ror32(__u32 word, int shift) +{ + return (word >> shift) | (word << (32 - shift)); +} + #endif |
