Count leading zeros (source code)

= Count leading zeros
{title2=$\operatorname{clz}_n(x)$}

= Leading-zero count
{synonym}

The number of zero <bits> before the first one, reading a fixed-width <binary representation> from its <most significant bit>. The all-zero $n$-<bit> input has count $n$. Thus $\operatorname{clz}_8(00000101)=5$, and $\operatorname{clz}_8(00000000)=8$; the width is part of the definition.