public static int intLogBase2(int value)
    {
        int temp1;
        int temp2 = value >> 16;

        if (temp2 > 0)
        {
            temp1 = temp2 >> 8;

            return (temp1 > 0) ? (24 + LOG_TABLE_256[temp1]) : (16 + LOG_TABLE_256[temp2]);
        }
        else
        {
            temp1 = value >> 8;

            return (temp1 > 0) ? (8 + LOG_TABLE_256[temp1]) : LOG_TABLE_256[value];
        }
    }
public static int intLogBase2 ( int value ) { int temp1 ; int temp2 = value > > 16 ; if ( temp2 > 0 ) { temp1 = temp2 > > 8 ; return ( temp1 > 0 ) ? ( 24 + LOG_TABLE_256 [ temp1 ] ) : ( 16 + LOG_TABLE_256 [ temp2 ] ) ; } else { temp1 = value > > 8 ; return ( temp1 > 0 ) ? ( 8 + LOG_TABLE_256 [ temp1 ] ) : LOG_TABLE_256 [ value ] ; } }
Calcalates the log base 2 of an integer. This code is tuned to uniformly distributed output values, longer
numbers are slightly favoured.

@param  value The value to calculate for.

@return Log base 2 of the input value.