1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* numeric.c (Init_Numeric): do not share implementation among

Fixnum#/ and Fixnum#div.  [ruby-core:05531]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-08-04 11:29:51 +00:00
parent c9ec812897
commit 4fd5436b32
3 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Aug 4 20:03:18 2005 Tadashi Saito <shiba@mail2.accsnet.ne.jp>
* numeric.c (Init_Numeric): do not share implementation among
Fixnum#/ and Fixnum#div. [ruby-core:05531]
Thu Aug 4 18:38:36 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tcltklib.c: cannot compile for Tcl7.6/Tk4.2.

View file

@ -2911,7 +2911,6 @@ Init_Numeric()
rb_define_method(rb_cFixnum, "-", fix_minus, 1);
rb_define_method(rb_cFixnum, "*", fix_mul, 1);
rb_define_method(rb_cFixnum, "/", fix_div, 1);
rb_define_method(rb_cFixnum, "div", fix_div, 1);
rb_define_method(rb_cFixnum, "%", fix_mod, 1);
rb_define_method(rb_cFixnum, "modulo", fix_mod, 1);
rb_define_method(rb_cFixnum, "divmod", fix_divmod, 1);

View file

@ -467,17 +467,19 @@ rb_range_beg_len(range, begp, lenp, len, err)
int err;
{
VALUE b, e;
long beg, end;
long beg, end, excl;
if (rb_obj_is_kind_of(range, rb_cRange)) {
b = rb_ivar_get(range, id_beg);
e = rb_ivar_get(range, id_end);
excl = EXCL(range);
}
else {
b = rb_check_to_integer(range, "begin");
if (NIL_P(b)) return Qnil;
e = rb_check_to_integer(range, "end");
if (NIL_P(e)) return Qnil;
excl = RTEST(rb_funcall(range, rb_intern("exclude_end?"), 0));
}
beg = NUM2LONG(b);
end = NUM2LONG(e);
@ -491,7 +493,7 @@ rb_range_beg_len(range, begp, lenp, len, err)
if (end > len) end = len;
}
if (end < 0) end += len;
if (!EXCL(range)) end++; /* include end point */
if (!excl) end++; /* include end point */
len = end - beg;
if (len < 0) len = 0;
@ -502,7 +504,7 @@ rb_range_beg_len(range, begp, lenp, len, err)
out_of_range:
if (err) {
rb_raise(rb_eRangeError, "%ld..%s%ld out of range",
b, EXCL(range)? "." : "", e);
b, excl ? "." : "", e);
}
return Qnil;
}