parent
5387c2cdb7
commit
7be9d0f049
@ -0,0 +1,3 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
unsigned ilog2(unsigned n); |
@ -0,0 +1,11 @@ |
|||||||
|
#include <bitops.h> |
||||||
|
|
||||||
|
unsigned ilog2(unsigned n) |
||||||
|
{ |
||||||
|
unsigned ret = 0; |
||||||
|
|
||||||
|
while (n >>= 1) |
||||||
|
++ret; |
||||||
|
|
||||||
|
return ret; |
||||||
|
} |
Loading…
Reference in new issue