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

ruby-changes:29696

From: akr <ko1@a...>
Date: Tue, 2 Jul 2013 21:20:12 +0900 (JST)
Subject: [ruby-changes:29696] akr:r41748 (trunk): * bignum.c (rb_cstr_to_inum): Merge two temporary buffers.

akr	2013-07-02 21:20:00 +0900 (Tue, 02 Jul 2013)

  New Revision: 41748

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

  Log:
    * bignum.c (rb_cstr_to_inum): Merge two temporary buffers.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41747)
+++ ChangeLog	(revision 41748)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  2 21:17:37 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
+
 Tue Jul  2 20:25:04 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41747)
+++ bignum.c	(revision 41748)
@@ -2095,7 +2095,7 @@ rb_cstr_to_inum(const char *str, int bas https://github.com/ruby/ruby/blob/trunk/bignum.c#L2095
             int j;
             size_t num_bdigits;
             size_t unit;
-            VALUE tmpu = 0, tmpv = 0;
+            VALUE tmpuv = 0;
             BDIGIT *uds, *vds, *tds;
 
             power = maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
@@ -2103,8 +2103,8 @@ rb_cstr_to_inum(const char *str, int bas https://github.com/ruby/ruby/blob/trunk/bignum.c#L2103
             size = p - buf;
             num_bdigits = roomof(size, digits_per_bdigits_dbl)*2;
 
-            uds = ALLOCV_N(BDIGIT, tmpu, num_bdigits);
-            vds = ALLOCV_N(BDIGIT, tmpv, num_bdigits);
+            uds = ALLOCV_N(BDIGIT, tmpuv, 2*num_bdigits);
+            vds = uds + num_bdigits;
 
             powerv = bignew(2, 1);
             BDIGITS(powerv)[0] = BIGLO(power);
@@ -2151,10 +2151,8 @@ rb_cstr_to_inum(const char *str, int bas https://github.com/ruby/ruby/blob/trunk/bignum.c#L2151
             z = bignew(num_bdigits, sign);
             MEMCPY(BDIGITS(z), uds, BDIGIT, num_bdigits);
 
-            if (tmpv)
-                ALLOCV_END(tmpv);
-            if (tmpu)
-                ALLOCV_END(tmpu);
+            if (tmpuv)
+                ALLOCV_END(tmpuv);
         }
     }
 

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

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