

#include <nitro/math.h>
int MATH_ILog2( u32 x );
| x | The numeric value for which log will be computed |
The integer part of the log to the base 2 of x, where x is non-zero. In the special case where x = 0-1 is returned.
This function calculates the log to the base 2 for the specified value and returns the integer part of the result. This computation yields the same result as a computation that searches for the location of the first standing bit in x. But because this is a logarithm, the value in the argument must be a positive number. If the argument holds 0, the function returns -1.
For the ARM9 ARM code, which supports CLZ commands, the function becomes an inline function that computes 31 - clz(x)
2004/12/14 Initial version.
CONFIDENTIAL