diff options
| author | Jun Hiroe <[email protected]> | 2014-04-13 00:37:55 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-04-13 00:37:55 +0900 |
| commit | f8e1633c0da09223a5b6dd727dfbcc584e03d74e (patch) | |
| tree | 5a993859ca10a47f660acb2b875480c2ab100b59 /src/numeric.c | |
| parent | a18f22e1b4c49c864ed00300053c01b10d799f85 (diff) | |
| download | mruby-f8e1633c0da09223a5b6dd727dfbcc584e03d74e.tar.gz mruby-f8e1633c0da09223a5b6dd727dfbcc584e03d74e.zip | |
Refactor fix_lshift
Diffstat (limited to 'src/numeric.c')
| -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 f7ee3103d..6998adacd 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1024,27 +1024,18 @@ fix_shift_get_width(mrb_state *mrb, mrb_int *width) static mrb_value fix_lshift(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 = rshift(val, -width); - } - else { - result = lshift(mrb, val, width); - } + val = mrb_fixnum(x); + if (width < 0) { + return(rshift(val, -width)); } - - return result; + return(lshift(mrb, val, width)); } /* 15.2.8.3.13 */ |
