BCH.BCHTool.nlpo2 C# (CSharp) Method

nlpo2() private static method

Next Largest Power of 2
private static nlpo2 ( int x ) : int
x int Input to round up to next 2^n
return int
        private static int nlpo2(int x)
        {
            x--; // comment out to always take the next biggest power of two, even if x is already a power of two
            x |= (x >> 1);
            x |= (x >> 2);
            x |= (x >> 4);
            x |= (x >> 8);
            x |= (x >> 16);
            return (x + 1);
        }