numeric.c: fix a bug in left shift of negative integer.
`-1 * (1<<63)` causes overflow, but `-1<<63` is a valid value.
MODIFY
src/numeric.c
src/numeric.c
@@ -1332,9 +1332,12 @@ mrb_num_shift(mrb_state *mrb, mrb_int val, mrb_int width, mrb_int *num)
}
else {
if ((width > NUMERIC_SHIFT_WIDTH_MAX) ||
- (val <= (MRB_INT_MIN >> width))) {
+ (val < (MRB_INT_MIN >> width))) {
return FALSE;
}
+ if (width == NUMERIC_SHIFT_WIDTH_MAX)
+ *num = MRB_INT_MIN;
+ else
*num = val * ((mrb_int)1 << width);
}
return TRUE;

numeric.c: fix a bug in left shift of negative integer.

`-1 * (1<<63)` causes overflow, but `-1<<63` is a valid value.