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

ruby-changes:5694

From: shyouhei <ko1@a...>
Date: Sun, 15 Jun 2008 19:56:47 +0900 (JST)
Subject: [ruby-changes:5694] Ruby:r17200 (ruby_1_8_5): merge revision(s) 15575:

shyouhei	2008-06-15 19:56:33 +0900 (Sun, 15 Jun 2008)

  New Revision: 17200

  Modified files:
    branches/ruby_1_8_5/ChangeLog
    branches/ruby_1_8_5/bignum.c
    branches/ruby_1_8_5/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_5/version.h?r1=17200&r2=17199&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/bignum.c?r1=17200&r2=17199&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/ChangeLog?r1=17200&r2=17199&diff_format=u

Index: ruby_1_8_5/ChangeLog
===================================================================
--- ruby_1_8_5/ChangeLog	(revision 17199)
+++ ruby_1_8_5/ChangeLog	(revision 17200)
@@ -1,3 +1,7 @@
+Sun Jun 15 19:55:46 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* bignum.c (BIGZEROP): fix for longer Bignum zeros.  [ruby-Bugs-17454]
+
 Sun Jun 15 19:53:16 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* bignum.c (big2str_find_n1): check integer overflow.
Index: ruby_1_8_5/version.h
===================================================================
--- ruby_1_8_5/version.h	(revision 17199)
+++ ruby_1_8_5/version.h	(revision 17200)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2008-06-15"
 #define RUBY_VERSION_CODE 185
 #define RUBY_RELEASE_CODE 20080615
-#define RUBY_PATCHLEVEL 183
+#define RUBY_PATCHLEVEL 184
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_5/bignum.c
===================================================================
--- ruby_1_8_5/bignum.c	(revision 17199)
+++ ruby_1_8_5/bignum.c	(revision 17200)
@@ -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/

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