2009-05-14 00:56:30 +02:00
|
|
|
#ifndef __ASM_GENERIC_GETORDER_H
|
|
|
|
#define __ASM_GENERIC_GETORDER_H
|
2005-09-04 00:54:30 +02:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2007-03-07 04:38:01 +01:00
|
|
|
#include <linux/compiler.h>
|
2005-09-04 00:54:30 +02:00
|
|
|
|
2007-03-07 04:38:01 +01:00
|
|
|
/* Pure 2^n version of get_order */
|
2009-05-14 00:56:30 +02:00
|
|
|
static inline __attribute_const__ int get_order(unsigned long size)
|
2005-09-04 00:54:30 +02:00
|
|
|
{
|
|
|
|
int order;
|
|
|
|
|
2007-03-07 04:38:01 +01:00
|
|
|
size = (size - 1) >> (PAGE_SHIFT - 1);
|
2005-09-04 00:54:30 +02:00
|
|
|
order = -1;
|
|
|
|
do {
|
|
|
|
size >>= 1;
|
|
|
|
order++;
|
|
|
|
} while (size);
|
|
|
|
return order;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
2009-05-14 00:56:30 +02:00
|
|
|
#endif /* __ASM_GENERIC_GETORDER_H */
|