(BignumInt)byte << (8*i % BIGNUM_INT_BITS);
}
- while (result[0] > 1 && result[result[0]] == 0)
- result[0]--;
+ bn_restore_invariant(result);
return result;
}
(BignumInt)byte << (8*i % BIGNUM_INT_BITS);
}
- while (result[0] > 1 && result[result[0]] == 0)
- result[0]--;
+ bn_restore_invariant(result);
return result;
}
*/
void bignum_set_bit(Bignum bn, int bitnum, int value)
{
- if (bitnum < 0 || bitnum >= (int)(BIGNUM_INT_BITS * bn[0]))
- abort(); /* beyond the end */
- else {
+ if (bitnum < 0 || bitnum >= (int)(BIGNUM_INT_BITS * bn[0])) {
+ if (value) abort(); /* beyond the end */
+ } else {
int v = bitnum / BIGNUM_INT_BITS + 1;
BignumInt mask = (BignumInt)1 << (bitnum % BIGNUM_INT_BITS);
if (value)
Bignum base, expt, modulus, expected, answer;
if (ptrnum != 4) {
- printf("%d: mul with %d parameters, expected 4\n", line, ptrnum);
+ printf("%d: pow with %d parameters, expected 4\n", line, ptrnum);
exit(1);
}