From Ryan Cumming <> Subject Re: [RFC, 2.6] a simple FIFO implementation Date Sat, 18 Sep 2004 00:56:44 -0700 On Friday 17 September 2004 20:41, Kyle Moffett wrote: This should probably be __const__, which is a stricter class of __pure__. The "__pure__" attribute means it has no side effects, whereas the "__const__" attribute means that it also _only_ depends on its arguments, not on any global memory or the data at any pointers passed to it. Good call. I was just copying the __pure__ from long_log2 function in kernel.h, which looks like it should be __const__ too. Here's a third try, with Andrew's and your suggestions. -Ryan --- a/include/linux/kernel.h 2004-09-16 06:38:19.000000000 -0700 +++ b/include/linux/kernel.h 2004-09-17 15:12:20.598844004 -0700 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -111,6 +112,10 @@ 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);