mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ae02ee6c7a
commit
26018bbfa7
4 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Nov 1 14:08:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* bignum.c (rb_big_aref): idx may be a Bignum.
|
||||
|
||||
* numeric.c (fix_aref): negative index must return zero.
|
||||
|
||||
Wed Oct 31 16:59:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (exec_under): should initialize ruby_frame->self;
|
||||
|
|
8
bignum.c
8
bignum.c
|
@ -1316,9 +1316,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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.6.5"
|
||||
#define RUBY_RELEASE_DATE "2001-10-31"
|
||||
#define RUBY_RELEASE_DATE "2001-11-01"
|
||||
#define RUBY_VERSION_CODE 165
|
||||
#define RUBY_RELEASE_CODE 20011031
|
||||
#define RUBY_RELEASE_CODE 20011101
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue