Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=de9330d13eac1f331e63ab1d18c506365b0151f3 Commit: de9330d13eac1f331e63ab1d18c506365b0151f3 Parent: 582539e5a0480f1e00e3b9ffbe50bd5b2f59a16f Author: Robert P. J. Day <[EMAIL PROTECTED]> AuthorDate: Wed Feb 6 01:36:54 2008 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Feb 6 10:41:03 2008 -0800
log2.h: Define order_base_2() macro for convenience. Given a number of places in the tree that need to calculate this value explicitly, might as well just create a macro for it. (akpm: must be implemented as a macro for callee typeof() usage) Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- include/linux/log2.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/log2.h b/include/linux/log2.h index c8cf5e8..25b8086 100644 --- a/include/linux/log2.h +++ b/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 */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html