mruby-bigint/bigint.c (udiv): skip loop if xd<yd.
MODIFY
mrbgems/mruby-bigint/core/bigint.c
mrbgems/mruby-bigint/core/bigint.c
@@ -459,6 +459,7 @@ udiv(mrb_state *mrb, mpz_t *qq, mpz_t *rr, mpz_t *xx, mpz_t *yy)
size_t xd = digits(&x);
mpz_realloc(mrb, &q, xd);
mp_dbl_limb z = y.p[yd-1];
+ if (xd>=yd) {
for (size_t j=xd-yd;; j--) {
mp_dbl_limb_signed b=0;
mp_dbl_limb qhat;
@@ -488,6 +489,7 @@ udiv(mrb_state *mrb, mpz_t *qq, mpz_t *rr, mpz_t *xx, mpz_t *yy)
q.p[j] = (mp_limb)qhat;
if (j == 0) break;
}
+ }
x.sz = yy->sz;
urshift(mrb, rr, &x, ns);
trim(&q);

mruby-bigint/bigint.c (udiv): skip loop if xd<yd.