We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e22afc commit 4887494Copy full SHA for 4887494
1 file changed
py/mpz.c
@@ -1497,13 +1497,10 @@ mpz_t *mpz_lcm(const mpz_t *z1, const mpz_t *z2) {
1497
quo * rhs + rem = lhs
1498
0 <= rem < rhs
1499
can have lhs, rhs the same
1500
+ assumes rhs != 0 (undefined behaviour if it is)
1501
*/
1502
void mpz_divmod_inpl(mpz_t *dest_quo, mpz_t *dest_rem, const mpz_t *lhs, const mpz_t *rhs) {
- if (rhs->len == 0) {
1503
- mpz_set_from_int(dest_quo, 0);
1504
- mpz_set_from_int(dest_rem, 0);
1505
- return;
1506
- }
+ assert(!mpz_is_zero(rhs));
1507
1508
mpz_need_dig(dest_quo, lhs->len + 1); // +1 necessary?
1509
memset(dest_quo->dig, 0, (lhs->len + 1) * sizeof(mpz_dig_t));
0 commit comments