summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-07 15:49:00 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-07 15:49:00 +0000
commit2b972a7f8030f0d96d4c66675dee5ddb1662931a (patch)
tree82b8908975845e1afd9b9b90729896728b1ba91e /bignum.c
parentb067aef7c0a26a6d689f214bff66ee318fa9ad17 (diff)
* bignum.c (rb_big_rshift): a bug in right shift of negative
bignums. [ruby-core:09020] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index ecf2872f08..17424b5148 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1811,6 +1811,10 @@ rb_big_rshift(VALUE x, VALUE y)
}
xds = BDIGITS(x);
i = RBIGNUM(x)->len; j = i - s1;
+ if (j == 0) {
+ if (RBIGNUM(x)->sign) return INT2FIX(0);
+ else return INT2FIX(-1);
+ }
z = bignew(j, RBIGNUM(x)->sign);
if (!RBIGNUM(x)->sign) {
num = ((BDIGIT_DBL)~0) << BITSPERDIG;