summary refs log tree commit diff stats
path: root/libs/cocos2d/Support/ccUtils.c
blob: 39786ec315a562a3a78d735e4d1a213c648bb5fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * cocos2d for iPhone: http://www.cocos2d-iphone.org
 *
 */

/*
 ccNextPOT function is licensed under the same license that is used in CCTexture2D.m.
 */
#include "ccUtils.h"

unsigned long ccNextPOT(unsigned long x)
{
    x = x - 1;
    x = x | (x >> 1);
    x = x | (x >> 2);
    x = x | (x >> 4);
    x = x | (x >> 8);
    x = x | (x >>16);
    return x + 1;
}