From 90a684d7570cf109b03d80b5184bcf34b1bad91d Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Wed, 6 Feb 2008 01:36:54 -0800 Subject: [PATCH] --- yaml --- r: 83414 b: refs/heads/master c: de9330d13eac1f331e63ab1d18c506365b0151f3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/log2.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 189182d5e07b..b6ccf14bc5b3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 582539e5a0480f1e00e3b9ffbe50bd5b2f59a16f +refs/heads/master: de9330d13eac1f331e63ab1d18c506365b0151f3 diff --git a/trunk/include/linux/log2.h b/trunk/include/linux/log2.h index c8cf5e8ef171..25b808631cd9 100644 --- a/trunk/include/linux/log2.h +++ b/trunk/include/linux/log2.h @@ -190,4 +190,20 @@ unsigned long __rounddown_pow_of_two(unsigned long n) __rounddown_pow_of_two(n) \ ) +/** + * order_base_2 - calculate the (rounded up) base 2 order of the argument + * @n: parameter + * + * The first few values calculated by this routine: + * ob2(0) = 0 + * ob2(1) = 0 + * ob2(2) = 1 + * ob2(3) = 2 + * ob2(4) = 2 + * ob2(5) = 3 + * ... and so on. + */ + +#define order_base_2(n) ilog2(roundup_pow_of_two(n)) + #endif /* _LINUX_LOG2_H */