aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index cbb0699209..372d578e37 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1324,9 +1324,15 @@ rb_big_aref(x, y)
VALUE x, y;
{
BDIGIT *xds;
- int shift = NUM2INT(y);
+ int shift;
int s1, s2;
+ if (TYPE(y) == T_BIGNUM) {
+ if (!RBIGNUM(y)->sign || RBIGNUM(x)->sign)
+ return INT2FIX(0);
+ return INT2FIX(1);
+ }
+ shift = NUM2INT(y);
if (shift < 0) return INT2FIX(0);
s1 = shift/BITSPERDIG;
s2 = shift%BITSPERDIG;