diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-01 05:11:24 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-01 05:11:24 +0000 |
commit | bbb608ad790db8495e092eede59df4bf3453f157 (patch) | |
tree | 29f6266cbaa73941c37f36d810f86a062e5ea066 /bignum.c | |
parent | a313c30d9c05d125b035a546bd3aa835bb7b88be (diff) |
* bignum.c (rb_big_aref): idx may be a Bignum.
* numeric.c (fix_aref): negative index must return zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; |