summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-11-01 05:11:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-11-01 05:11:24 +0000
commit26018bbfa7f25b4941ec40caa96e596e3d1f64c1 (patch)
tree8de433e24f1266a795b161473907f8071ccd78ef /numeric.c
parentae02ee6c7a5958876ccbae7bead3990dea6f807c (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/branches/ruby_1_6@1810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 33ec3605e6..d5896fe2d3 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1305,7 +1305,8 @@ fix_aref(fix, idx)
long val = FIX2LONG(fix);
if (TYPE(idx) == T_BIGNUM) {
- if (val >= 0) return INT2FIX(0);
+ if (!RBIGNUM(idx)->sign || val >= 0)
+ return INT2FIX(0);
return INT2FIX(1);
}
else {