mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_to_integer, rb_check_to_integer): return Bignum
as-is. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
898bb1cbe3
commit
b1f618e9e5
2 changed files with 7 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Jul 12 23:30:26 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* object.c (rb_to_integer, rb_check_to_integer): return Bignum
|
||||||
|
as-is.
|
||||||
|
|
||||||
Sun Jul 12 21:07:46 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
Sun Jul 12 21:07:46 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* complex.c: use k_exact_{zero,one}_p macro.
|
* complex.c: use k_exact_{zero,one}_p macro.
|
||||||
|
|
2
object.c
2
object.c
|
@ -2057,6 +2057,7 @@ rb_to_integer(VALUE val, const char *method)
|
||||||
VALUE v;
|
VALUE v;
|
||||||
|
|
||||||
if (FIXNUM_P(val)) return val;
|
if (FIXNUM_P(val)) return val;
|
||||||
|
if (TYPE(val) == T_BIGNUM) return val;
|
||||||
v = convert_type(val, "Integer", method, Qtrue);
|
v = convert_type(val, "Integer", method, Qtrue);
|
||||||
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
|
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
|
||||||
const char *cname = rb_obj_classname(val);
|
const char *cname = rb_obj_classname(val);
|
||||||
|
@ -2072,6 +2073,7 @@ rb_check_to_integer(VALUE val, const char *method)
|
||||||
VALUE v;
|
VALUE v;
|
||||||
|
|
||||||
if (FIXNUM_P(val)) return val;
|
if (FIXNUM_P(val)) return val;
|
||||||
|
if (TYPE(val) == T_BIGNUM) return val;
|
||||||
v = convert_type(val, "Integer", method, Qfalse);
|
v = convert_type(val, "Integer", method, Qfalse);
|
||||||
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
|
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
Loading…
Add table
Reference in a new issue