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

ruby-changes:29816

From: akr <ko1@a...>
Date: Tue, 9 Jul 2013 22:45:01 +0900 (JST)
Subject: [ruby-changes:29816] akr:r41868 (trunk): * bignum.c (bary_mul_single): Invoke MEMZERO here.

akr	2013-07-09 22:44:49 +0900 (Tue, 09 Jul 2013)

  New Revision: 41868

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

  Log:
    * bignum.c (bary_mul_single): Invoke MEMZERO here.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41867)
+++ ChangeLog	(revision 41868)
@@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jul  9 22:17:58 2013  Tanaka Akira  <akr@f...>
+Tue Jul  9 22:24:39 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bary_mul1): No need to invoke MEMZERO at last.
+	  (bary_mul_single): Invoke MEMZERO here.
 
 Tue Jul  9 21:40:01 2013  Kouhei Sutou  <kou@c...>
 
Index: bignum.c
===================================================================
--- bignum.c	(revision 41867)
+++ bignum.c	(revision 41868)
@@ -1439,6 +1439,8 @@ bary_mul_single(BDIGIT *zds, size_t zl, https://github.com/ruby/ruby/blob/trunk/bignum.c#L1439
     n = (BDIGIT_DBL)x * y;
     zds[0] = BIGLO(n);
     zds[1] = (BDIGIT)BIGDN(n);
+
+    MEMZERO(zds + 2, BDIGIT, zl - 2);
 }
 
 static int
@@ -1787,16 +1789,12 @@ rb_big_mul_karatsuba(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L1789
 static void
 bary_mul1(BDIGIT *zds, size_t zl, BDIGIT *xds, size_t xl, BDIGIT *yds, size_t yl)
 {
-    size_t l;
-
     assert(xl + yl <= zl);
 
     if (xl == 1 && yl == 1) {
-        l = 2;
         bary_mul_single(zds, zl, xds[0], yds[0]);
     }
     else {
-        l = xl + yl;
         bary_mul_normal(zds, zl, xds, xl, yds, yl);
         rb_thread_check_ints();
     }

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

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