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

Expanded f_mod

This commit is contained in:
Nobuyoshi Nakada 2019-08-02 11:19:29 +09:00
parent 8ba8ccc3cc
commit 6de61fb9ed
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -43,13 +43,6 @@ static ID id_abs, id_idiv, id_integer_p,
static VALUE nurat_to_f(VALUE self);
#define binop(n,op) \
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
return rb_funcall(x, (op), 1, y); \
}
#define fun1(n) \
inline static VALUE \
f_##n(VALUE x)\
@ -87,7 +80,13 @@ f_lt_p(VALUE x, VALUE y)
#ifndef NDEBUG
/* f_mod is used only in f_gcd defined when NDEBUG is not defined */
binop(mod, '%')
inline static VALUE
f_mod(VALUE x, VALUE y)
{
if (RB_INTEGER_TYPE_P(x))
return rb_int_modulo(x, y);
return rb_funcall(x, '%', 1, y);
}
#endif
inline static VALUE