-BigInteger::BigInteger(unsigned int x) {
- if (x == 0)
- sign = zero;
- else {
- cap = 1;
- blk = new Blk[1];
- sign = positive;
- len = 1;
- blk[0] = Blk(x);
- }
-}
-
-BigInteger::BigInteger(int x) {
- if (x > 0) {
- cap = 1;
- blk = new Blk[1];
- sign = positive;
- len = 1;
- blk[0] = Blk(x);
- } else if (x < 0) {
- cap = 1;
- blk = new Blk[1];
- sign = negative;
- len = 1;
- blk[0] = Blk(-x);
- } else
- sign = zero;
-}
-
-BigInteger::BigInteger(unsigned short x) {
- if (x == 0)
- sign = zero;
- else {
- cap = 1;
- blk = new Blk[1];
- sign = positive;
- len = 1;
- blk[0] = Blk(x);
- }
-}
-
-BigInteger::BigInteger(short x) {
- if (x > 0) {
- cap = 1;
- blk = new Blk[1];
- sign = positive;
- len = 1;
- blk[0] = Blk(x);
- } else if (x < 0) {
- cap = 1;
- blk = new Blk[1];
- sign = negative;
- len = 1;
- blk[0] = Blk(-x);
- } else
- sign = zero;
-}
-
-// CONVERTERS
-/*
-* The steps for conversion of a BigInteger to an
-* integral type are as follows:
-* 1. If the BigInteger is zero, return zero.
-* 2. If the BigInteger is positive:
-* 3. If it is more than one block long or its lowest
-* block has bits set out of the range of the target
-* type, throw an exception.
-* 4. Otherwise, convert the lowest block to the
-* target type and return it.
-* 5. If the BigInteger is negative:
-* 6. If the target type is unsigned, throw an exception.
-* 7. If it is more than one block long or its lowest
-* block has bits set out of the range of the target
-* type, throw an exception.
-* 8. Otherwise, convert the lowest block to the
-* target type, negate it, and return it.
-*/