public static int intLogBase2v3(int value)
    {
        int result = 0;

        if ((value & LOG2_V3_BRANCH_VALUES[4]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[4];
            result |= LOG2_V3_SHIFT_VALUES[4];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[3]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[3];
            result |= LOG2_V3_SHIFT_VALUES[3];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[2]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[2];
            result |= LOG2_V3_SHIFT_VALUES[2];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[1]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[1];
            result |= LOG2_V3_SHIFT_VALUES[1];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[0]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[0];
            result |= LOG2_V3_SHIFT_VALUES[0];
        }

        return result;
    }
public static int intLogBase2v3(int value)
    {
        int result = 0;

        if ((value & LOG2_V3_BRANCH_VALUES[4]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[4];
            result |= LOG2_V3_SHIFT_VALUES[4];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[3]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[3];
            result |= LOG2_V3_SHIFT_VALUES[3];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[2]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[2];
            result |= LOG2_V3_SHIFT_VALUES[2];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[1]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[1];
            result |= LOG2_V3_SHIFT_VALUES[1];
        }

        if ((value & LOG2_V3_BRANCH_VALUES[0]) > 0)
        {
            value >>= LOG2_V3_SHIFT_VALUES[0];
            result |= LOG2_V3_SHIFT_VALUES[0];
        }

        return result;
    }
public static int intLogBase2v3 ( int value ) { int result = 0 ; if ( ( value & LOG2_V3_BRANCH_VALUES [ 4 ] ) > 0 ) { value >>= LOG2_V3_SHIFT_VALUES [ 4 ] ; result |= LOG2_V3_SHIFT_VALUES [ 4 ] ; } if ( ( value & LOG2_V3_BRANCH_VALUES [ 3 ] ) > 0 ) { value >>= LOG2_V3_SHIFT_VALUES [ 3 ] ; result |= LOG2_V3_SHIFT_VALUES [ 3 ] ; } if ( ( value & LOG2_V3_BRANCH_VALUES [ 2 ] ) > 0 ) { value >>= LOG2_V3_SHIFT_VALUES [ 2 ] ; result |= LOG2_V3_SHIFT_VALUES [ 2 ] ; } if ( ( value & LOG2_V3_BRANCH_VALUES [ 1 ] ) > 0 ) { value >>= LOG2_V3_SHIFT_VALUES [ 1 ] ; result |= LOG2_V3_SHIFT_VALUES [ 1 ] ; } if ( ( value & LOG2_V3_BRANCH_VALUES [ 0 ] ) > 0 ) { value >>= LOG2_V3_SHIFT_VALUES [ 0 ] ; result |= LOG2_V3_SHIFT_VALUES [ 0 ] ; } return result ; }
Calcalates the log base 2 of an integer in O(log(N)) steps; shorter numbers are favoured.

@param  value The value to calculate for.

@return Log base 2 of the input value.
Calcalates the log base 2 of an integer in O ( log ( N )) steps ; shorter numbers are favoured .