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

ruby-changes:30749

From: akr <ko1@a...>
Date: Wed, 4 Sep 2013 20:23:13 +0900 (JST)
Subject: [ruby-changes:30749] akr:r42828 (trunk): * bignum.c (bigdivrem_normal): Add assertions.

akr	2013-09-04 20:23:05 +0900 (Wed, 04 Sep 2013)

  New Revision: 42828

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

  Log:
    * bignum.c (bigdivrem_normal): Add assertions.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42827)
+++ ChangeLog	(revision 42828)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Sep  4 20:22:43 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigdivrem_normal): Add assertions.
+
 Wed Sep  4 19:18:40 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* internal.h (vm_state_version_t): prefer LONG_LONG to uint64_t.
Index: bignum.c
===================================================================
--- bignum.c	(revision 42827)
+++ bignum.c	(revision 42828)
@@ -2640,6 +2640,9 @@ bigdivrem_normal(BDIGIT *zds, size_t zn, https://github.com/ruby/ruby/blob/trunk/bignum.c#L2640
 {
     int shift;
 
+    assert(zn == xn + 1);
+    assert(yn < xn || (xn == yn && yds[yn - 1] <= xds[xn - 1]));
+
     shift = nlz(yds[yn-1]);
     if (shift) {
         bary_small_lshift(yds, yds, yn, shift);

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

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