diff options
| author | Ryan Cumming <ryan@spitfire.gotdns.org> | 2004-09-22 04:21:55 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-22 04:21:55 -0700 |
| commit | c88d19d6380f0a3af3bca20303ce3c6c654019e6 (patch) | |
| tree | 9ebefc583ddf1839ebfa08e56c138eaf5c7cc436 | |
| parent | b68bd84e7a06348a58ec645dd4af75e1df5cbe35 (diff) | |
[PATCH] implement roundup_pow_two()
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | include/linux/kernel.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index a1cf3568a64e..40307a28bb4b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -12,6 +12,7 @@ #include <linux/stddef.h> #include <linux/types.h> #include <linux/compiler.h> +#include <linux/bitops.h> #include <asm/byteorder.h> #include <asm/bug.h> @@ -111,6 +112,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x) 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(int ratelimit_jiffies, int ratelimit_burst); |
