mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* marshal.c (Init_marshal): new constant Marshal::MAJOR_VERSION
and Marshal::MINOR_VERSION. * marshal.c (marshal_load): ruby_verbose test should be wrapped by RTEST(). * hash.c (rb_hash_index): should return nil (not the default value) if value is not in the hash. * numeric.c (num_div): new method added. alias to '/' which should be preserved even if '/' is redefined (e.g. by mathn). [new] * bignum.c (rb_cstr2inum): "0 ff".hex should return 0, not 255. * file.c (rb_file_s_expand_path): fixed using CharNext(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
645170199c
commit
c8a7361e45
9 changed files with 73 additions and 13 deletions
|
@ -115,6 +115,13 @@ num_uminus(num)
|
|||
return rb_funcall(zero, '-', 1, num);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
num_div(x, y)
|
||||
VALUE x, y;
|
||||
{
|
||||
return rb_funcall(x, '/', 1, y);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
num_divmod(x, y)
|
||||
VALUE x, y;
|
||||
|
@ -1543,6 +1550,7 @@ Init_Numeric()
|
|||
rb_define_method(rb_cNumeric, "-@", num_uminus, 0);
|
||||
rb_define_method(rb_cNumeric, "===", num_equal, 1);
|
||||
rb_define_method(rb_cNumeric, "eql?", num_eql, 1);
|
||||
rb_define_method(rb_cNumeric, "div", num_div, 1);
|
||||
rb_define_method(rb_cNumeric, "divmod", num_divmod, 1);
|
||||
rb_define_method(rb_cNumeric, "modulo", num_modulo, 1);
|
||||
rb_define_method(rb_cNumeric, "remainder", num_remainder, 1);
|
||||
|
@ -1591,6 +1599,7 @@ 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue