1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>MATH_CountLeadingZeros</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">MATH_CountLeadingZeros<img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <nitro/math.h></CODE></PRE> 16 <PRE><CODE>u32 MATH_CountLeadingZeros( u32 x ); 17u32 MATH_CLZ( u32 x ); 18 19 </CODE></PRE> 20</DL> 21<H2>Arguments</H2> 22<TABLE border="1"> 23 <TBODY> 24 <TR> 25 <TD><B><I>x</I></B></TD> 26 <TD>The value to scan</TD> 27 </TR> 28 </TBODY> 29</TABLE> 30<H2>Return Values</H2> 31<P>The number of sequential <code>0</code> bits, starting from the highest order bit.</P> 32<H2>Description</H2> 33<P>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 <code>CLZ</code> 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.</P> 34<P><CODE>MATH_CLZ</CODE> is another name for the <CODE>MATH_CountLeadingZeros</CODE> function.</P> 35<P>To count the number of consecutive <code>0</code>'s from the end, you can use the <CODE><A href="../bit/MATH_CountTrailingZeros.html">MATH_CountTrailingZeros</A></CODE> function.</P> 36<H2>See Also</H2> 37<P><CODE><A href="../bit/MATH_CountTrailingZeros.html">MATH_CountTrailingZeros</A>, <A href="../int/MATH_ILog2.html">MATH_ILog2</A><BR></CODE></P> 38<H2>Revision History</H2> 39<P> 402006/01/10 Added missing links <br>2005/12/22 Added a link to the <CODE>MATH_CountTrailingZeros</CODE> function. <br>2005/06/02 Changed <CODE>&</CODE> to <CODE>&amp;</CODE>. <BR>2004/12/14 Initial version. 41</P> 42<hr><p>CONFIDENTIAL</p></body> 43</HTML> 44