Byte-table leading-zero count (source code)

= Byte-table leading-zero count
{title2=$L(0)=8,\quad L(b)=7-\lfloor\log_2b\rfloor\ (b>0)$}

For <leading-zero count>, inspect a word's bytes from most significant to least significant. Every zero byte contributes eight; the first nonzero byte contributes its table value in the title. If all bytes are zero, a word of width $w$ contributes $w$. Defining the zero table entry explicitly makes the all-zero argument a regular case rather than an out-of-range logarithm.