cntlzw

Scott Wood scottwood at freescale.com
Wed Jun 4 06:11:10 EST 2008


Kevin Diggs wrote:
> Hi,
> 
>     x86 has bsf and bsr. PPC has cntlzw which I think is equivalent to 
> bsr. Anyone know of a sneaky algorithm to do bsf?

wordsize - 1 - cntlzw(x & ~(x - 1));

-Scott



More information about the Linuxppc-dev mailing list