#include <nitro/math.h>
u32 MATH_CountLeadingZeros( u32 x );
u32 MATH_CLZ( u32 x );
x | The value to scan |
The number of sequential 0
bits, starting from the highest order bit.
This function scans the data of a 32-bit quantity and reports the number of sequential bits that are set to 0 beginning at the highest-order bit. For example, a value of 0x80000000 will return 0, and a value of 0 will return 32. The internal implementation is such that the function is an inline function wrapping a CLZ
command that can be used with ARM9 ARM code. It is expanded as one instruction by the compiler. For ARM7 and also for ARM9 Thumb code, the normal function gets called.
MATH_CLZ
is just another name for the MATH_CountLeadingZeros
function.
To count the number of consecutive 0
's from the end, you can use the MATH_CountTrailingZeros
function.
MATH_CountTrailingZeros MATH_ILog2
01/10/2006 Added missing links
12/22/2005 Added a link to the MATH_CountTrailingZeros
function.
06/02/2005 Revised & to &
12/14/2004 Initial version.