BigInteger.BigInteger C# (CSharp) Method

BigInteger() public method

public BigInteger ( long value ) : System
value long
return System
        public BigInteger(long value)
        {
                data = new uint[maxLength];
                long tempVal = value;

                // copy bytes from long to BigInteger without any assumption of
                // the length of the long datatype

                dataLength = 0;
                while(value != 0 && dataLength < maxLength)
                {
                        data[dataLength] = (uint)(value & 0xFFFFFFFF);
                        value >>= 32;
                        dataLength++;
                }

                if(tempVal > 0)         // overflow check for +ve value
                {
                        if(value != 0 || (data[maxLength-1] & 0x80000000) != 0)
                                throw(new ArithmeticException("Positive overflow in constructor."));
                }
                else if(tempVal < 0)    // underflow check for -ve value
                {
                        if(value != -1 || (data[dataLength-1] & 0x80000000) == 0)
                                throw(new ArithmeticException("Negative underflow in constructor."));
                }

                if(dataLength == 0)
                        dataLength = 1;
        }

Same methods

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