base/common/src/main/com/thesett/common/util/FibonacciHeap.java
private static int ceilingLog2(int n)
    {
        int oa;
        int i;
        int b;

        oa = n;
        b = 32 / 2;
        i = 0;

        while (b != 0)
        {
            i = (i << 1);

            if (n >= (1 << b))
            {
                n /= (1 << b);
                i = i | 1;
            }
            else
            {
                n &= (1 << b) - 1;
            }

            b /= 2;
        }

        if ((1 << i) == oa)
        {
            return i;
        }
        else
        {
            return i + 1;
        }
    }
private static int ceilingLog2(int n)
    {
        int oa;
        int i;
        int b;

        oa = n;
        b = 32 / 2;
        i = 0;

        while (b != 0)
        {
            i = (i << 1);

            if (n >= (1 << b))
            {
                n /= (1 << b);
                i = i | 1;
            }
            else
            {
                n &= (1 << b) - 1;
            }

            b /= 2;
        }

        if ((1 << i) == oa)
        {
            return i;
        }
        else
        {
            return i + 1;
        }
    }
Calculates the smallest integer value, m, such that m^2 >= n. The ceiling log2 of n.

@param  n The value to calulate ceiling log 2 of.

@return The smallest integer value, m, such that m^2 >= n.

@todo   This can possibly be done more neatly. Consult Hackers Delight or aggregate.org for the following
algorithm: y = (x & (x - 1)); y |= -y; y >>= (WORDBITS - 1); x |= (x >> 1); x |= (x >> 2); x |= (x >> 4);
x |= (x >> 8); x |= (x >> 16); #ifdef LOG0UNDEFINED return(ones(x) - 1 - y); #else return(ones(x >> 1) -
y); #endif