/include/asm-generic/getorder.h

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t · C Header · 24 lines · 17 code · 6 blank · 1 comment · 1 complexity · 388765f460d789656c2cf21b86af4200 MD5 · raw file

  1. #ifndef __ASM_GENERIC_GETORDER_H
  2. #define __ASM_GENERIC_GETORDER_H
  3. #ifndef __ASSEMBLY__
  4. #include <linux/compiler.h>
  5. /* Pure 2^n version of get_order */
  6. static inline __attribute_const__ int get_order(unsigned long size)
  7. {
  8. int order;
  9. size = (size - 1) >> (PAGE_SHIFT - 1);
  10. order = -1;
  11. do {
  12. size >>= 1;
  13. order++;
  14. } while (size);
  15. return order;
  16. }
  17. #endif /* __ASSEMBLY__ */
  18. #endif /* __ASM_GENERIC_GETORDER_H */