summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/char/random.c5
-rw-r--r--include/linux/bitops.h22
2 files changed, 22 insertions, 5 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index cd2b261611bf..59c8c4152296 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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);
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