Ahhh. This code is designed for big-endian processors. I'm testing on x86, which is little-endian. For little endian you can reorder the table, or change the last line to:
return 31-clz_table[n >> 27];
Dan East
number to bitshift