Commit c445c6c7 authored by Akira Kuroda's avatar Akira Kuroda

refactor fix_mod

fix unreachable condition
use b
parent 260d38d5
...@@ -774,17 +774,17 @@ static mrb_value ...@@ -774,17 +774,17 @@ static mrb_value
fix_mod(mrb_state *mrb, mrb_value x) fix_mod(mrb_state *mrb, mrb_value x)
{ {
mrb_value y; mrb_value y;
mrb_int a, b; mrb_int a;
mrb_get_args(mrb, "o", &y); mrb_get_args(mrb, "o", &y);
a = mrb_fixnum(x); a = mrb_fixnum(x);
if (mrb_fixnum_p(y) && (b=mrb_fixnum(y)) != 0) { if (mrb_fixnum_p(y)) {
mrb_int mod; mrb_int b, mod;
if (mrb_fixnum(y) == 0) { if ((b=mrb_fixnum(y)) == 0) {
return mrb_float_value(mrb, NAN); return mrb_float_value(mrb, NAN);
} }
fixdivmod(mrb, a, mrb_fixnum(y), 0, &mod); fixdivmod(mrb, a, b, 0, &mod);
return mrb_fixnum_value(mod); return mrb_fixnum_value(mod);
} }
else { else {
......
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