From 4ea5c5610aeadecf78fdd2b7d6faad8574953620 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 3 Aug 2019 08:37:08 +0900 Subject: Predefine some IDs --- numeric.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'numeric.c') 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 -- cgit v1.2.3