Messages in this thread Patch in this message | | | Date | Fri, 21 Jan 2005 15:41:06 -0600 | From | Matt Mackall <> | Subject | [PATCH 1/12] random pt4: Create new rol32/ror32 bitops |
| |
Add rol32 and ror32 bitops to bitops.h
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: rnd2/drivers/char/random.c =================================================================== --- rnd2.orig/drivers/char/random.c 2005-01-19 22:59:59.000000000 -0800 +++ rnd2/drivers/char/random.c 2005-01-20 09:18:47.000000000 -0800 @@ -374,11 +374,6 @@ 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); Index: rnd2/include/linux/bitops.h =================================================================== --- rnd2.orig/include/linux/bitops.h 2005-01-19 22:57:54.000000000 -0800 +++ rnd2/include/linux/bitops.h 2005-01-20 09:20:24.641660815 -0800 @@ -134,4 +134,26 @@ 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |