Jurassic.BigInteger.MultiplyPow5 C# (CSharp) Method

MultiplyPow5() public static method

Computes b x 5 ^ k.
public static MultiplyPow5 ( BigInteger b, int k ) : BigInteger
b BigInteger
k int
return BigInteger
        public static BigInteger MultiplyPow5(BigInteger b, int k)
        {
            BigInteger p5;

            // Fast route if k <= 3.
            if ((k & 3) != 0)
                b = MultiplyAdd(b, powersOfFive[(k & 3) - 1], 0);
            if ((k >>= 2) == 0)
                return b;

            p5 = new BigInteger(625);
            while (true)
            {
                if ((k & 1) == 1)
                    b = Multiply(b, p5);
                if ((k >>= 1) == 0)
                    break;
                p5 = Multiply(p5, p5);
            }
            return b;
        }