Permalink
Browse files

Bit-shifting zero should be zero; ref #3620

  • Loading branch information...
matz committed Apr 20, 2017
1 parent d2cad9a commit 3567b262227c6188da21bac2896eea4587bd1de5
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/numeric.c
View
@@ -995,6 +995,7 @@ fix_lshift(mrb_state *mrb, mrb_value x)
return x;
}
val = mrb_fixnum(x);
if (val == 0) return x;
if (width < 0) {
return rshift(val, -width);
}
@@ -1019,6 +1020,7 @@ fix_rshift(mrb_state *mrb, mrb_value x)
return x;
}
val = mrb_fixnum(x);
if (val == 0) return x;
if (width < 0) {
return lshift(mrb, val, -width);
}

0 comments on commit 3567b26

Please sign in to comment.