1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (bigdivrem): Zero test condition simplified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-13 15:15:07 +00:00
parent 51c43dba6a
commit 65575bab02
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Fri Jun 14 00:14:29 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (bigdivrem): Zero test condition simplified.
Thu Jun 13 23:43:11 2013 Zachary Scott <zachary@zacharyscott.net>
* ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn

View file

@ -3762,11 +3762,14 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
BDIGIT_DBL t2;
BDIGIT dd, q;
if (BIGZEROP(y)) rb_num_zerodiv();
xds = BDIGITS(x);
yds = BDIGITS(y);
while (0 < ny && !yds[ny-1]) ny--;
if (ny == 0)
rb_num_zerodiv();
xds = BDIGITS(x);
while (0 < nx && !xds[nx-1]) nx--;
while (!yds[ny-1]) ny--;
if (nx < ny || (nx == ny && xds[nx - 1] < yds[ny - 1])) {
if (divp) *divp = rb_int2big(0);
if (modp) *modp = x;