aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 08:37:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 10:18:39 +0900
commit4ea5c5610aeadecf78fdd2b7d6faad8574953620 (patch)
tree466d75d43f9d734a74affdbe1bce7e1d2e9e2e8e /numeric.c
parent0bd1cd677f769ac6128989bf1d021753698fdaac (diff)
downloadruby-4ea5c5610aeadecf78fdd2b7d6faad8574953620.tar.gz
Predefine some IDs
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/numeric.c b/numeric.c
index 7ce6590bfd..2f5da6f887 100644
--- a/numeric.c
+++ b/numeric.c
@@ -171,7 +171,9 @@ static VALUE flo_to_i(VALUE num);
static int float_round_overflow(int ndigits, int binexp);
static int float_round_underflow(int ndigits, int binexp);
-static ID id_coerce, id_div, id_divmod;
+static ID id_coerce;
+#define id_div idDiv
+#define id_divmod idDivmod
#define id_to_i idTo_i
#define id_eq idEq
#define id_cmp idCmp
@@ -3717,7 +3719,7 @@ fix_fdiv_double(VALUE x, VALUE y)
return double_div_double(FIX2LONG(x), RFLOAT_VALUE(y));
}
else {
- return NUM2DBL(rb_num_coerce_bin(x, y, rb_intern("fdiv")));
+ return NUM2DBL(rb_num_coerce_bin(x, y, idFdiv));
}
}
@@ -5561,8 +5563,8 @@ Init_Numeric(void)
_set_Creg(0, 0);
#endif
id_coerce = rb_intern("coerce");
- id_div = rb_intern("div");
- id_divmod = rb_intern("divmod");
+ id_to = rb_intern("to");
+ id_by = rb_intern("by");
rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);
rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eRangeError);
@@ -5821,9 +5823,6 @@ Init_Numeric(void)
rb_define_method(rb_cFloat, "prev_float", flo_prev_float, 0);
rb_define_method(rb_cFloat, "positive?", flo_positive_p, 0);
rb_define_method(rb_cFloat, "negative?", flo_negative_p, 0);
-
- id_to = rb_intern("to");
- id_by = rb_intern("by");
}
#undef rb_float_value