Fixed call to __builtin_clz()
ilog2() erroneously called __builtin_clzl() instead of __builtin_clz()
This commit is contained in:
@@ -5,7 +5,7 @@ int ilog2(unsigned int x)
|
|||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
if(x <= 1)
|
if(x <= 1)
|
||||||
return 0;
|
return 0;
|
||||||
return 32 - __builtin_clzl(x - 1);
|
return 32 - __builtin_clz(x - 1);
|
||||||
#else
|
#else
|
||||||
static const int table[32] = {
|
static const int table[32] = {
|
||||||
0, 9, 1, 10, 13, 21, 2, 29,
|
0, 9, 1, 10, 13, 21, 2, 29,
|
||||||
|
|||||||
Reference in New Issue
Block a user