diff options
| author | Jun Hiroe <[email protected]> | 2014-04-13 00:41:22 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-04-13 00:41:22 +0900 |
| commit | 996343caa2281d35324c297ea8867a56da0891ad (patch) | |
| tree | 2f786264d975ac038a8de25c00beaf95eb8fe618 /src | |
| parent | f8e1633c0da09223a5b6dd727dfbcc584e03d74e (diff) | |
| download | mruby-996343caa2281d35324c297ea8867a56da0891ad.tar.gz mruby-996343caa2281d35324c297ea8867a56da0891ad.zip | |
Refactor fix_rshift
Diffstat (limited to 'src')
| -rw-r--r-- | src/numeric.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/numeric.c b/src/numeric.c index 6998adacd..e5fc59ec8 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1049,27 +1049,18 @@ fix_lshift(mrb_state *mrb, mrb_value x) static mrb_value fix_rshift(mrb_state *mrb, mrb_value x) { - mrb_int width; - mrb_value result; + mrb_int width, val; fix_shift_get_width(mrb, &width); if (width == 0) { - result = x; + return(x); } - else { - mrb_int val; - - val = mrb_fixnum(x); - if (width < 0) { - result = lshift(mrb, val, -width); - } - else { - result = rshift(val, width); - } + val = mrb_fixnum(x); + if (width < 0) { + return(lshift(mrb, val, -width)); } - - return result; + return(rshift(val, width)); } /* 15.2.8.3.23 */ |
