Optimize bigdivrem Part 4

e$BK-J!$G$9!#e(B

big2str_karatsuba e$B$Ge(B bigdivmod e$B$K$h$j5a$a$?>&$HM>$j$Ne(B
Bignum
e$B$ND9$5$,:GE,$JD9$5$H?)$$0c$o$J$$$h$&$K$7$^$9!#e(B
e$B8=:_$3$N?)$$0c$$$,$"$C$F$b9,$$LdBj$O5/$-$^$;$s$,8=>u$,K>$^$7$$e(B
e$B$H$O;W$([email protected]$rDs0F$7$^$9!#e(B

bignum.c.org
+++ bignum.c
@@ -1764,6 +1752,7 @@
zds = BDIGITS(*divp);
j = (nx==ny ? nx+2 : nx+1) - ny;
for (i = 0;i < j;i++) zds[i] = zds[i+ny];

  •   if (!zds[i-1]) i--;
      RBIGNUM_SET_LEN(*divp, i);
    
    }
    if (modp) { /* normalize remainder */
    @@ -1779,6 +1768,7 @@
    t2 = BIGUP(q);
    }
    }
  •   if (!zds[ny-1]) ny--;
      RBIGNUM_SET_LEN(*modp, ny);
      RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));
    
    }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs