Alex Ionescu wrote:
Addon = 16;
if ((IntMask = Mask >> 16)) {
Addon = 0;
IntMask = Mask;
}
if (IntMask && 0xFFFFFF00) {
Addon += 8;
}
HighBit = LogTable256[(Mask >> Addon)] + Addon;
methinks there's bugs there, use this instead:
int highest_bit_tabled ( unsigned int i )
{
int ret = 0;
if ( i > 0xffff )
i >>= 16, ret = 16;
if ( i > 0xff )
i >>= 8, ret += 8;
return ret + LogTable256[i];
}
also, FWIW, I've tried the following three tests:
( i > 0xffff )
( i & 0xffff0000 )
( i >> 16 )
and the first is the fastest on my a64