Lines Matching defs:MutableBigInteger

49 class MutableBigInteger {
51 * Holds the magnitude of this MutableBigInteger in big endian order.
59 * to hold the magnitude of this MutableBigInteger. The magnitude starts
66 * MutableBigInteger begins.
72 * MutableBigInteger with one element value array with the value 1. Used by
76 static final MutableBigInteger ONE = new MutableBigInteger(1);
81 * The default constructor. An empty MutableBigInteger is created with
84 MutableBigInteger() {
90 * Construct a new MutableBigInteger with a magnitude specified by
93 MutableBigInteger(int val) {
100 * Construct a new MutableBigInteger with the specified value array
103 MutableBigInteger(int[] val) {
109 * Construct a new MutableBigInteger with a magnitude equal to the
112 MutableBigInteger(BigInteger b) {
118 * Construct a new MutableBigInteger with a magnitude equal to the
119 * specified MutableBigInteger.
121 MutableBigInteger(MutableBigInteger val) {
137 * Convert this MutableBigInteger to a long value. The caller has to make
138 * sure this MutableBigInteger can be fit into long.
141 assert (intLen <= 2) : "this MutableBigInteger exceeds the range of long";
149 * Convert this MutableBigInteger to a BigInteger object.
158 * Convert this MutableBigInteger to BigDecimal object with the specified sign
167 // If this MutableBigInteger can't be fit into long, we need to
178 * Clear out a MutableBigInteger for reuse.
187 * Set a MutableBigInteger to zero, removing its offset.
195 * as this MutableBigInteger is numerically less than, equal to, or
198 final int compare(MutableBigInteger b) {
220 * Compare this against half of a MutableBigInteger object (Needed for
225 final int compareHalf(MutableBigInteger b) {
260 * Return the index of the lowest set bit in this MutableBigInteger. If the
261 * magnitude of this MutableBigInteger is zero, -1 is returned.
276 * Return the int in use in this MutableBigInteger at the specified
286 * use in this MutableBigInteger at the specified index. This method is
294 * Ensure that the MutableBigInteger is in normal form, specifically
319 * If this MutableBigInteger cannot hold len words, increase the size
331 * Convert this MutableBigInteger into an int array with no leading
332 * zeros, of a length that is equal to this MutableBigInteger's intLen.
342 * Sets the int at index+offset in this MutableBigInteger to val.
351 * Sets this MutableBigInteger's value array to the specified array.
361 * Sets this MutableBigInteger's value array to a copy of the specified
364 void copyValue(MutableBigInteger src) {
374 * Sets this MutableBigInteger's value array to a copy of the specified
387 * Returns true iff this MutableBigInteger has a value of one.
394 * Returns true iff this MutableBigInteger has a value of zero.
401 * Returns true iff this MutableBigInteger is even.
408 * Returns true iff this MutableBigInteger is odd.
415 * Returns true iff this MutableBigInteger is in normal form. A
416 * MutableBigInteger is in normal form if it has no leading zeros
428 * Returns a String representation of this MutableBigInteger in radix 10.
436 * Right shift this MutableBigInteger n bits. The MutableBigInteger is left
457 * Left shift this MutableBigInteger n bits.
461 * If there is enough storage space in this MutableBigInteger already
547 * Right shift this MutableBigInteger n bits, where n is
563 * Left shift this MutableBigInteger n bits, where n is
579 * Adds the contents of two MutableBigInteger objects.The result
580 * is placed within this MutableBigInteger.
583 void add(MutableBigInteger addend) {
640 * result into this MutableBigInteger.
642 int subtract(MutableBigInteger b) {
643 MutableBigInteger a = this;
653 MutableBigInteger tmp = a;
694 private int difference(MutableBigInteger b) {
695 MutableBigInteger a = this;
700 MutableBigInteger tmp = a;
728 * Multiply the contents of two MutableBigInteger objects. The result is
729 * placed into MutableBigInteger z. The contents of y are not changed.
731 void multiply(MutableBigInteger y, MutableBigInteger z) {
770 * Multiply the contents of this MutableBigInteger by the word y. The
773 void mul(int y, MutableBigInteger z) {
814 int divideOneWord(int divisor, MutableBigInteger quotient) {
872 * provided MutableBigInteger objects and the remainder object is returned.
881 MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) {
888 return new MutableBigInteger();
895 return new MutableBigInteger(this);
901 return new MutableBigInteger();
909 return new MutableBigInteger();
910 return new MutableBigInteger(r);
920 * quotient in the provided MutableBigInteger object and the remainder is
925 long divide(long v, MutableBigInteger quotient) {
949 * Divide this MutableBigInteger by the divisor represented by its magnitude
953 private MutableBigInteger divideMagnitude(int[] divisor,
954 MutableBigInteger quotient) {
957 MutableBigInteger rem = new MutableBigInteger(new int[intLen + 1]);
1110 MutableBigInteger hybridGCD(MutableBigInteger b) {
1113 MutableBigInteger a = this;
1114 MutableBigInteger q = new MutableBigInteger();
1120 MutableBigInteger r = a.divide(b, q);
1131 private MutableBigInteger binaryGCD(MutableBigInteger v) {
1133 MutableBigInteger u = this;
1134 MutableBigInteger r = new MutableBigInteger();
1147 MutableBigInteger t = uOdd ? v: u;
1217 MutableBigInteger mutableModInverse(MutableBigInteger p) {
1230 MutableBigInteger oddMod = new MutableBigInteger(p);
1237 MutableBigInteger oddPart = modInverse(oddMod);
1240 MutableBigInteger evenPart = modInverseMP2(powersOf2);
1243 MutableBigInteger y1 = modInverseBP2(oddMod, powersOf2);
1244 MutableBigInteger y2 = oddMod.modInverseMP2(powersOf2);
1246 MutableBigInteger temp1 = new MutableBigInteger();
1247 MutableBigInteger temp2 = new MutableBigInteger();
1248 MutableBigInteger result = new MutableBigInteger();
1263 MutableBigInteger modInverseMP2(int k) {
1274 return new MutableBigInteger(t);
1284 MutableBigInteger result = new MutableBigInteger(new int[2]);
1308 static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
1310 return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
1322 private MutableBigInteger modInverse(MutableBigInteger mod) {
1323 MutableBigInteger p = new MutableBigInteger(mod);
1324 MutableBigInteger f = new MutableBigInteger(this);
1325 MutableBigInteger g = new MutableBigInteger(p);
1328 MutableBigInteger temp = null;
1380 static MutableBigInteger fixup(MutableBigInteger c, MutableBigInteger p,
1382 MutableBigInteger temp = new MutableBigInteger();
1418 MutableBigInteger euclidModInverse(int k) {
1419 MutableBigInteger b = new MutableBigInteger(1);
1421 MutableBigInteger mod = new MutableBigInteger(b);
1423 MutableBigInteger a = new MutableBigInteger(this);
1424 MutableBigInteger q = new MutableBigInteger();
1425 MutableBigInteger r = b.divide(a, q);
1427 MutableBigInteger swapper = b;
1432 MutableBigInteger t1 = new MutableBigInteger(q);
1433 MutableBigInteger t0 = new MutableBigInteger(1);
1434 MutableBigInteger temp = new MutableBigInteger();