16 0, 9, 1, 10, 13, 21, 2, 29,
17 11, 14, 16, 18, 22, 25, 3, 30,
18 8, 12, 20, 28, 15, 17, 24, 7,
19 19, 27, 23, 6, 26, 5, 4, 31
24 0, 1, 28, 2, 29, 14, 24, 3,
25 30, 22, 20, 15, 25, 17, 4, 8,
26 31, 27, 13, 23, 21, 19, 16, 7,
27 26, 12, 18, 6, 11, 5, 10, 9
33 return (value > 0) && ((value & (value - 1)) == 0);
38 return (value > 0) && ((value & (value - 1)) == 0);
43 uint32_t log2 = (powerOfTwo & 0xAAAAAAAAu) != 0;
44 log2 |= ((powerOfTwo & 0xFFFF0000u) != 0) << 4;
45 log2 |= ((powerOfTwo & 0xFF00FF00u) != 0) << 3;
46 log2 |= ((powerOfTwo & 0xF0F0F0F0u) != 0) << 2;
47 log2 |= ((powerOfTwo & 0xCCCCCCCCu) != 0) << 1;
53 uint32_t log2 = (powerOfTwo & 0xAAAAAAAAu) != 0;
54 log2 |= ((powerOfTwo & 0xFFFF0000u) != 0) << 4;
55 log2 |= ((powerOfTwo & 0xFF00FF00u) != 0) << 3;
56 log2 |= ((powerOfTwo & 0xF0F0F0F0u) != 0) << 2;
57 log2 |= ((powerOfTwo & 0xCCCCCCCCu) != 0) << 1;
58 return static_cast<int32_t
>(log2);
68 uint32_t key = (value * 0x07C4ACDDu) >> 27;
69 return gsLeadingBitTable[key];
79 uint32_t key = (value * 0x07C4ACDDu) >> 27;
80 return gsLeadingBitTable[key];
109 #pragma warning(push) 110 #pragma warning(disable : 4146) // Do not warn on negation of uint32_t. 111 uint32_t key = ((uint32_t)((value & -value) * 0x077CB531u)) >> 27;
112 return gsTrailingBitTable[key];
118 uint32_t key = ((uint32_t)((value & -value) * 0x077CB531u)) >> 27;
119 return gsTrailingBitTable[key];
151 uint32_t
mask = (1 << leading);
152 if ((value & ~mask) == 0)
155 return static_cast<uint64_t
>(
value);
160 return (static_cast<uint64_t>(mask) << 1);
175 uint32_t
mask = (1 << leading);
GTE_IMPEXP int32_t GetTrailingBit(uint32_t value)
GTE_IMPEXP uint32_t RoundDownToPowerOfTwo(uint32_t value)
GTE_IMPEXP int32_t GetLeadingBit(uint32_t value)
static int32_t const gsLeadingBitTable[32]
GLsizei const GLfloat * value
#define GTE_GET_HI_U64(v)
#define GTE_GET_HI_I64(v)
#define GTE_GET_LO_U64(v)
#define GTE_GET_LO_I64(v)
static int32_t const gsTrailingBitTable[32]
GTE_IMPEXP bool IsPowerOfTwo(uint32_t value)
GTE_IMPEXP uint64_t RoundUpToPowerOfTwo(uint32_t value)
GTE_IMPEXP uint32_t Log2OfPowerOfTwo(uint32_t powerOfTwo)