Commit c88d19d6 authored by Ryan Cumming's avatar Ryan Cumming Committed by Linus Torvalds

[PATCH] implement roundup_pow_two()

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b68bd84e
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/bitops.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/bug.h> #include <asm/bug.h>
...@@ -111,6 +112,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x) ...@@ -111,6 +112,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x)
return r; return r;
} }
static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x)
{
return (1UL << fls(x - 1));
}
extern int printk_ratelimit(void); extern int printk_ratelimit(void);
extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
......
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