//table
static const int8 xs_KotayBits[32]
=
{
0,
1, 2, 16, 3, 6,
17, 21,
14,
4, 7, 9, 18, 11, 22, 26,
31, 15,
5, 20, 13, 8, 10, 25,
30, 19, 12, 24, 29, 23, 28, 27
};
//only works for powers of 2 inputs
static inline int32 xs_ILogPow2
(int32 v)
{
//constant is
binary 10 01010 11010 00110 01110 11111
return
xs_KotayBits[(uint32(v)*uint32( 0x04ad19df ))>>27];
}