/*
* Matt McCutchen's Big Integer Library
-* http://hashproduct.metaesthetics.net/bigint/
*/
#include "BigUnsigned.hh"
for (i = 0; i < a.len; i++) {
// For each 1-bit of that block...
for (i2 = 0; i2 < N; i2++) {
- if ((a.blk[i] & (1 << i2)) == 0)
+ if ((a.blk[i] & (Blk(1) << i2)) == 0)
continue;
/*
* Add b to this, shifted left i blocks and i2 bits.
* amusing story of this section of code.
*/
Index origLen = len; // Save real length.
+ // 2006.05.03: Copy the number and then change the length!
+ allocateAndCopy(len + 1); // Get the space.
len++; // Increase the length.
- allocateAndCopy(len); // Get the space.
blk[origLen] = 0; // Zero the extra block.
// work2 holds part of the result of a subtraction; see above.
* the region of work2 we copy is just [i, k).
*/
if (!borrowIn) {
- q.blk[i] |= (1 << i2);
+ q.blk[i] |= (Blk(1) << i2);
while (k > i) {
k--;
blk[k] = work2[k];
a2 = &b;
b2 = &a;
}
- allocate(b2->len);
+ allocate(a2->len);
for (i = 0; i < b2->len; i++)
blk[i] = a2->blk[i] ^ b2->blk[i];
for (; i < a2->len; i++)