diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-16 15:02:42 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-16 15:02:42 +0900 |
| commit | cb1659c191683a81f86a576a8a80dcfbefa99146 (patch) | |
| tree | aa283e4fcb8a631844afd8e49f6f1e2edf33abac | |
| parent | c136d871b99644c9593bd73a51e026d3f9257e7f (diff) | |
| parent | cdb49ab608aeff45a8b8da335730372f7120cc59 (diff) | |
| download | mruby-cb1659c191683a81f86a576a8a80dcfbefa99146.tar.gz mruby-cb1659c191683a81f86a576a8a80dcfbefa99146.zip | |
Merge pull request #2066 from suzukaze/refactor-numeric2
Refactor numeric.c
| -rw-r--r-- | src/numeric.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/numeric.c b/src/numeric.c index ef9308aea..bda667280 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -980,8 +980,7 @@ lshift(mrb_state *mrb, mrb_int val, mrb_int width) mrb_fixnum_value(width), mrb_fixnum_value(NUMERIC_SHIFT_WIDTH_MAX)); } - val = val << width; - return mrb_fixnum_value(val); + return mrb_fixnum_value(val << width); } static mrb_value @@ -1009,8 +1008,7 @@ fix_shift_get_width(mrb_state *mrb, mrb_int *width) mrb_value y; mrb_get_args(mrb, "o", &y); - y = bit_coerce(mrb, y); - *width = mrb_fixnum(y); + *width = mrb_fixnum(bit_coerce(mrb, y)); } /* 15.2.8.3.12 */ @@ -1075,11 +1073,7 @@ fix_rshift(mrb_state *mrb, mrb_value x) static mrb_value fix_to_f(mrb_state *mrb, mrb_value num) { - mrb_float val; - - val = (mrb_float)mrb_fixnum(num); - - return mrb_float_value(mrb, val); + return mrb_float_value(mrb, (mrb_float)mrb_fixnum(num)); } /* |
