Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 1 | #ifndef _ASM_GENERIC_PAGE_H |
| 2 | #define _ASM_GENERIC_PAGE_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | #ifndef __ASSEMBLY__ |
| 6 | |
Linus Torvalds | 38f3323 | 2007-03-06 19:38:01 -0800 | [diff] [blame] | 7 | #include <linux/compiler.h> |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 8 | |
Linus Torvalds | 38f3323 | 2007-03-06 19:38:01 -0800 | [diff] [blame] | 9 | /* Pure 2^n version of get_order */ |
| 10 | static __inline__ __attribute_const__ int get_order(unsigned long size) |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 11 | { |
| 12 | int order; |
| 13 | |
Linus Torvalds | 38f3323 | 2007-03-06 19:38:01 -0800 | [diff] [blame] | 14 | size = (size - 1) >> (PAGE_SHIFT - 1); |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 15 | order = -1; |
| 16 | do { |
| 17 | size >>= 1; |
| 18 | order++; |
| 19 | } while (size); |
| 20 | return order; |
| 21 | } |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 22 | |
| 23 | #endif /* __ASSEMBLY__ */ |
| 24 | #endif /* __KERNEL__ */ |
| 25 | |
| 26 | #endif /* _ASM_GENERIC_PAGE_H */ |