mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rational.c: f_idiv
* rational.c (f_idiv): call rb_int_idiv directly if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1dd076c557
commit
14b3dc1ec4
1 changed files with 7 additions and 8 deletions
15
rational.c
15
rational.c
|
@ -53,13 +53,6 @@ f_##n(VALUE x)\
|
||||||
return rb_funcall(x, id_##n, 0);\
|
return rb_funcall(x, id_##n, 0);\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define fun2(n) \
|
|
||||||
inline static VALUE \
|
|
||||||
f_##n(VALUE x, VALUE y)\
|
|
||||||
{\
|
|
||||||
return rb_funcall(x, id_##n, 1, y);\
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static VALUE
|
inline static VALUE
|
||||||
f_add(VALUE x, VALUE y)
|
f_add(VALUE x, VALUE y)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +147,13 @@ f_eqeq_p(VALUE x, VALUE y)
|
||||||
return (int)rb_equal(x, y);
|
return (int)rb_equal(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
fun2(idiv)
|
inline static VALUE
|
||||||
|
f_idiv(VALUE x, VALUE y)
|
||||||
|
{
|
||||||
|
if (RB_INTEGER_TYPE_P(x))
|
||||||
|
return rb_int_idiv(x, y);
|
||||||
|
return rb_funcall(x, id_idiv, 1, y);
|
||||||
|
}
|
||||||
|
|
||||||
#define f_expt10(x) rb_int_pow(INT2FIX(10), x)
|
#define f_expt10(x) rb_int_pow(INT2FIX(10), x)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue