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

ruby-changes:31686

From: mrkn <ko1@a...>
Date: Thu, 21 Nov 2013 21:42:07 +0900 (JST)
Subject: [ruby-changes:31686] mrkn:r43765 (trunk): * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size

mrkn	2013-11-21 21:42:01 +0900 (Thu, 21 Nov 2013)

  New Revision: 43765

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

  Log:
    * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
      of the digit array.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43764)
+++ ChangeLog	(revision 43765)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Nov 21 21:40:00 2013  Kenta Murata  <mrkn@m...>
+
+	* ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
+	  of the digit array.
+
 Thu Nov 21 21:36:00 2013  Kenta Murata  <mrkn@m...>
 
 	* ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 43764)
+++ ext/bigdecimal/bigdecimal.c	(revision 43765)
@@ -3816,7 +3816,9 @@ VpAlloc(size_t mx, const char *szVal) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L3816
     size_t mf = VpGetPrecLimit();
     VALUE buf;
 
-    mx = (mx + BASE_FIG - 1) / BASE_FIG + 1;    /* Determine allocation unit. */
+    mx = (mx + BASE_FIG - 1) / BASE_FIG;    /* Determine allocation unit. */
+    if (mx == 0) ++mx;
+
     if (szVal) {
 	while (ISSPACE(*szVal)) szVal++;
 	if (*szVal != '#') {

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

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