21 INT Y(exp2i)(
const INT a)
32 INT Y(log2i)(
const INT m)
38 #if SIZEOF_PTRDIFF_T == 8
40 static INT debruijn[64] =
42 0, 58, 1, 59, 47, 53, 2, 60, 39, 48, 27, 54, 33, 42, 3, 61, 51, 37, 40, 49,
43 18, 28, 20, 55, 30, 34, 11, 43, 14, 22, 4, 62, 57, 46, 52, 38, 26, 32, 41,
44 50, 36, 17, 19, 29, 10, 13, 21, 56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15,
48 register uint64_t v = (uint64_t)(m);
63 return debruijn[(uint64_t)(v * 0x03f6eaf2cd271461LU) >> 58];
64 #elif SIZEOF_PTRDIFF_T == 4
66 static INT debruijn[32] =
68 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28,
69 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
72 register uint32_t v = (uint32_t)(m);
86 return debruijn[(uint32_t)(v * 0x07C4ACDDU) >> 27];
88 #error Incompatible size of ptrdiff_t
101 INT Y(next_power_of_2)(
const INT x)
109 uint64_t v = (uint64_t)x;
118 #if SIZEOF_PTRDIFF_T >= 2
121 #if SIZEOF_PTRDIFF_T >= 4
124 #if SIZEOF_PTRDIFF_T >= 8
136 void Y(next_power_of_2_exp)(
const INT N, INT *N2, INT *t)
139 INT N_is_not_power_of_2=0;
154 N_is_not_power_of_2=1;
160 if (!N_is_not_power_of_2)
165 for (i = 0; i <= logn; i++)
175 void Y(next_power_of_2_exp_int)(
const int N,
int *N2,
int *t)
178 int N_is_not_power_of_2=0;
193 N_is_not_power_of_2=1;
199 if (!N_is_not_power_of_2)
204 for (i = 0; i <= logn; i++)