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

ruby-changes:5696

From: shyouhei <ko1@a...>
Date: Sun, 15 Jun 2008 19:58:29 +0900 (JST)
Subject: [ruby-changes:5696] Ruby:r17202 (ruby_1_8_6): merge revision(s) 15575:

shyouhei	2008-06-15 19:57:55 +0900 (Sun, 15 Jun 2008)

  New Revision: 17202

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/bignum.c
    branches/ruby_1_8_6/version.h

  Log:
    merge revision(s) 15575:
    * bignum.c (BIGZEROP): fix for longer Bignum zeros.  [ruby-Bugs-17454]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/ChangeLog?r1=17202&r2=17201&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/version.h?r1=17202&r2=17201&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/bignum.c?r1=17202&r2=17201&diff_format=u

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 17201)
+++ ruby_1_8_6/ChangeLog	(revision 17202)
@@ -1,3 +1,7 @@
+Sun Jun 15 19:56:53 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* bignum.c (BIGZEROP): fix for longer Bignum zeros.  [ruby-Bugs-17454]
+
 Sun Jun 15 19:54:21 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* bignum.c (big2str_find_n1): check integer overflow.
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 17201)
+++ ruby_1_8_6/version.h	(revision 17202)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2008-06-15"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20080615
-#define RUBY_PATCHLEVEL 184
+#define RUBY_PATCHLEVEL 185
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_6/bignum.c
===================================================================
--- ruby_1_8_6/bignum.c	(revision 17201)
+++ ruby_1_8_6/bignum.c	(revision 17202)
@@ -36,8 +36,22 @@
 #define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
 #define BDIGMAX ((BDIGIT)-1)
 
-#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0))
+#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || \
+		     (BDIGITS(x)[0] == 0 && \
+		      (RBIGNUM(x)->len == 1 || bigzero_p(x))))
 
+static int bigzero_p(VALUE);
+static int
+bigzero_p(x)
+    VALUE x;
+{
+    long i;
+    for (i = 0; i < RBIGNUM(x)->len; ++i) {
+	if (BDIGITS(x)[i]) return 0;
+    }
+    return 1;
+}
+
 static VALUE
 bignew_1(klass, len, sign)
     VALUE klass;

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

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