[前][次][番号順一覧][スレッド一覧]

ruby-changes:29236

From: akr <ko1@a...>
Date: Fri, 14 Jun 2013 00:15:16 +0900 (JST)
Subject: [ruby-changes:29236] akr:r41288 (trunk): * bignum.c (bigdivrem): Zero test condition simplified.

akr	2013-06-14 00:15:07 +0900 (Fri, 14 Jun 2013)

  New Revision: 41288

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41288

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

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41287)
+++ ChangeLog	(revision 41288)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 14 00:14:29 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigdivrem): Zero test condition simplified.
+
 Thu Jun 13 23:43:11 2013  Zachary Scott  <zachary@z...>
 
 	* ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
Index: bignum.c
===================================================================
--- bignum.c	(revision 41287)
+++ bignum.c	(revision 41288)
@@ -3762,11 +3762,14 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L3762
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]