Jason Gloudon wrote: > http://www.ddj.com/ftp/2001/2001_07/aa0701.txt > > I believe the LOOKUP method was the fastest for me on SPARC, if I recall > correctly.
Did they really spend 64K to create a lookup table just to find the most significant bit? Calculating log2 for a power of two is simpler -- all you need to find is the one set bit. If you really want to use lookup tables, just use an 8 byte table and shift by 4 bits until a non-zero is found. (Change constants to taste.) - Ken