summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJun Hiroe <[email protected]>2014-05-03 01:13:43 +0900
committerJun Hiroe <[email protected]>2014-05-03 01:13:43 +0900
commit129e5a6c21047f94d9ce56ea779ef88f154c51f7 (patch)
tree0595d5227a2a142c8199140f18ec6ee14222dd42
parent85d286b4b8e292b870a266360fb135670d427a41 (diff)
downloadmruby-129e5a6c21047f94d9ce56ea779ef88f154c51f7.tar.gz
mruby-129e5a6c21047f94d9ce56ea779ef88f154c51f7.zip
Refactor rshift
-rw-r--r--src/numeric.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/numeric.c b/src/numeric.c
index 46b3cdf37..4c955a61e 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -980,17 +980,11 @@ rshift(mrb_int val, mrb_int width)
mrb_assert(width >= 0);
if (width >= NUMERIC_SHIFT_WIDTH_MAX) {
if (val < 0) {
- val = -1;
- }
- else {
- val = 0;
+ return mrb_fixnum_value(-1);
}
+ return mrb_fixnum_value(0);
}
- else {
- val = val >> width;
- }
-
- return mrb_fixnum_value(val);
+ return mrb_fixnum_value(val >> width);
}
static inline void