/libs/cocos2d/Support/ccUtils.c

http://github.com/kstenerud/ObjectAL-for-iPhone · C · 18 lines · 10 code · 1 blank · 7 comment · 0 complexity · fe22f1980a9e5cb413b6e8431a477249 MD5 · raw file

  1. /*
  2. * cocos2d for iPhone: http://www.cocos2d-iphone.org
  3. *
  4. */
  5. /*
  6. ccNextPOT function is licensed under the same license that is used in CCTexture2D.m.
  7. */
  8. unsigned int ccNextPOT(unsigned int x)
  9. {
  10. x = x - 1;
  11. x = x | (x >> 1);
  12. x = x | (x >> 2);
  13. x = x | (x >> 4);
  14. x = x | (x >> 8);
  15. x = x | (x >>16);
  16. return x + 1;
  17. }