blob: 14db733b8e68e7df3cb95bb685eb97cc0125a094 [file] [log] [blame]
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -07001#ifndef _ASM_GENERIC_PAGE_H
2#define _ASM_GENERIC_PAGE_H
3
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -07004#ifndef __ASSEMBLY__
5
Linus Torvalds38f33232007-03-06 19:38:01 -08006#include <linux/compiler.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -07007
Linus Torvalds38f33232007-03-06 19:38:01 -08008/* Pure 2^n version of get_order */
9static __inline__ __attribute_const__ int get_order(unsigned long size)
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070010{
11 int order;
12
Linus Torvalds38f33232007-03-06 19:38:01 -080013 size = (size - 1) >> (PAGE_SHIFT - 1);
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070014 order = -1;
15 do {
16 size >>= 1;
17 order++;
18 } while (size);
19 return order;
20}
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070021
22#endif /* __ASSEMBLY__ */
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070023
24#endif /* _ASM_GENERIC_PAGE_H */