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