summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-13 00:30:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-13 00:30:15 +0000
commit96c31ac787a64d9c21eb498fc8af7e85e100eb5a (patch)
treea1e2f2e759f4e2621fe14e9bd49b3aea4aad5af9 /bignum.c
parent0f71c10acbb86ea272b665b61782bf5b502c11fc (diff)
* bignum.c (bigfixize): zero length Bignum is 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index f508f71e02..3a317d0065 100644
--- a/bignum.c
+++ b/bignum.c
@@ -191,7 +191,8 @@ bigfixize(VALUE x)
long len = RBIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
- if (len > 0 && len*SIZEOF_BDIGITS <= sizeof(long)) {
+ if (len == 0) return INT2FIX(0);
+ if (len*SIZEOF_BDIGITS <= sizeof(long)) {
long num = 0;
#if 2*SIZEOF_BDIGITS > SIZEOF_LONG
num = (long)ds[0];