diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-14 18:02:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-14 20:42:10 +0900 |
commit | 5bd83909b961546ff6203ad088bfffeb8c19fceb (patch) | |
tree | 681b11c4e21eb7d3fb29253a10ca64ca9bd9ec42 /complex.c | |
parent | 1464f7a149264b02637fdd444f8a431f1692981a (diff) | |
download | bundler-5bd83909b961546ff6203ad088bfffeb8c19fceb.tar.gz |
Expand f_arg to use particular functions directly
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -170,7 +170,27 @@ f_abs(VALUE x) return rb_funcall(x, id_abs, 0); } -fun1(arg) +static VALUE numeric_arg(VALUE self); +static VALUE float_arg(VALUE self); + +inline static VALUE +f_arg(VALUE x) +{ + if (RB_INTEGER_TYPE_P(x)) { + return numeric_arg(x); + } + else if (RB_FLOAT_TYPE_P(x)) { + return float_arg(x); + } + else if (RB_TYPE_P(x, T_RATIONAL)) { + return numeric_arg(x); + } + else if (RB_TYPE_P(x, T_COMPLEX)) { + return rb_complex_arg(x); + } + return rb_funcall(x, id_arg, 0); +} + fun1(denominator) inline static VALUE |