Commit 18684e6e authored by Matt Mackall's avatar Matt Mackall Committed by Linus Torvalds

[PATCH] random: Create new rol32/ror32 bitops

Add rol32 and ror32 bitops to bitops.h
Signed-off-by: default avatarMatt Mackall <mpm@selenic.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c41f39c1
......@@ -374,11 +374,6 @@ static struct poolinfo {
static DECLARE_WAIT_QUEUE_HEAD(random_read_wait);
static DECLARE_WAIT_QUEUE_HEAD(random_write_wait);
static inline __u32 rol32(__u32 word, int shift)
{
return (word << shift) | (word >> (32 - shift));
}
#if 0
static int debug = 0;
module_param(debug, bool, 0644);
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment