MATH_CountTrailingZeros

Syntax

#include <nitro/math.h>
u32 MATH_CountTrailingZeros( u32 x );
u32 MATH_CTZ( u32 x );
 
  

Arguments

x The value to scan

Return Values

Returns the number of consecutive bits set to 0, starting from the lowest-order bit.

Description

This function finds the number of bits set to 0 starting from the lowest-order bit when x is expressed as a binary 32-bit value. For example, a value of 0x80000000 will return 31, and a value of 0 will return 32. This is an inline function that uses the MATH_CountLeadingZeros function.

MATH_CTZ is another name for the MATH_CountTrailingZeros function.

To count the number of consecutive 0's from the beginning, you can use the MATH_CountLeadingZeros function.

See Also

MATH_CountLeadingZeros, MATH_ILog2

Revision History

2005/12/22 Initial version.


CONFIDENTIAL