BigInteger.BigInteger C# (CSharp) Method

BigInteger() public method

public BigInteger ( byte inData ) : System
inData byte
return System
        public BigInteger(byte[] inData)
        {
                dataLength = inData.Length >> 2;

                int leftOver = inData.Length & 0x3;
                if(leftOver != 0)         // length not multiples of 4
                        dataLength++;


                if(dataLength > maxLength)
                      throw(new ArithmeticException("Byte overflow in constructor."));

                data = new uint[maxLength];

                for(int i = inData.Length - 1, j = 0; i >= 3; i -= 4, j++)
                {
                        data[j] = (uint)((inData[i-3] << 24) + (inData[i-2] << 16) +
                                         (inData[i-1] <<  8) + inData[i]);
                }

                if(leftOver == 1)
                        data[dataLength-1] = (uint)inData[0];
                else if(leftOver == 2)
                        data[dataLength-1] = (uint)((inData[0] << 8) + inData[1]);
                else if(leftOver == 3)
                        data[dataLength-1] = (uint)((inData[0] << 16) + (inData[1] << 8) + inData[2]);


                while(dataLength > 1 && data[dataLength-1] == 0)
                        dataLength--;

                //Console.WriteLine("Len = " + dataLength);
        }

Same methods

BigInteger::BigInteger ( ) : System
BigInteger::BigInteger ( BigInteger, bi ) : System
BigInteger::BigInteger ( byte inData, int inLen ) : System
BigInteger::BigInteger ( long value ) : System
BigInteger::BigInteger ( string value, int radix ) : System
BigInteger::BigInteger ( uint inData ) : System
BigInteger::BigInteger ( ulong value ) : System