Commit 72fe54c4 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2172 from suzukaze/refactor-numeric.c

Refactor rshift
parents 85d286b4 129e5a6c
...@@ -980,17 +980,11 @@ rshift(mrb_int val, mrb_int width) ...@@ -980,17 +980,11 @@ rshift(mrb_int val, mrb_int width)
mrb_assert(width >= 0); mrb_assert(width >= 0);
if (width >= NUMERIC_SHIFT_WIDTH_MAX) { if (width >= NUMERIC_SHIFT_WIDTH_MAX) {
if (val < 0) { if (val < 0) {
val = -1; return mrb_fixnum_value(-1);
}
else {
val = 0;
} }
return mrb_fixnum_value(0);
} }
else { return mrb_fixnum_value(val >> width);
val = val >> width;
}
return mrb_fixnum_value(val);
} }
static inline void static inline void
......
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