X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Flog2.h;h=25b808631cd92c50d10cf6a31b2d9b9942b62ac9;hb=7597bc94d6f3bdccb086ac7f2ad91292fdaee2a4;hp=c8cf5e8ef1717d40cde2768fd0608f29924b1545;hpb=c548f08a4f7b89b93c805e0c4024b8302afa7121;p=linux-2.6-omap-h63xx.git diff --git a/include/linux/log2.h b/include/linux/log2.h index c8cf5e8ef17..25b808631cd 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 */