simplify Fixnum#==

parent 1ef77ab3
...@@ -863,15 +863,16 @@ static mrb_value ...@@ -863,15 +863,16 @@ static mrb_value
fix_equal(mrb_state *mrb, mrb_value x) fix_equal(mrb_state *mrb, mrb_value x)
{ {
mrb_value y; mrb_value y;
mrb_bool equal_p;
mrb_get_args(mrb, "o", &y); mrb_get_args(mrb, "o", &y);
switch (mrb_type(y)) {
equal_p = mrb_obj_equal(mrb, x, y) || case MRB_TT_FIXNUM:
(mrb_type(y) == MRB_TT_FLOAT && return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
(mrb_float)mrb_fixnum(x) == mrb_float(y)); case MRB_TT_FLOAT:
return mrb_bool_value((mrb_float)mrb_fixnum(x) == mrb_float(y));
return mrb_bool_value(equal_p); default:
return mrb_false_value();
}
} }
/* 15.2.8.3.8 */ /* 15.2.8.3.8 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment