summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:56:33 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:56:33 +0000
commite6b158dea9743fac7807d9ae0bb634066d2b2643 (patch)
tree9230a8dd56fa234bd5e4c87a76e022a6886b18d1
parentc71b916f37c5dc0c0202b4410af2c3dc1c740bb9 (diff)
merge revision(s) 15575:
* bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c16
-rw-r--r--version.h2
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6bb10d1b36..49ae48b0c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jun 15 19:55:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]
+
Sun Jun 15 19:53:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (big2str_find_n1): check integer overflow.
diff --git a/bignum.c b/bignum.c
index 80ab1c936b..ee9c38aff9 100644
--- a/bignum.c
+++ b/bignum.c
@@ -36,7 +36,21 @@ VALUE rb_cBignum;
#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)
diff --git a/version.h b/version.h
index 96dcbc131a..c3c348f410 100644
--- a/version.h
+++ b/version.h
@@ -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