diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-16 09:51:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-16 09:51:27 +0900 |
| commit | 752edf413f09fb3e78d79ca7d752ae5dc2e25c02 (patch) | |
| tree | 0bcf7c0e0395790f3645abc5717d8171f2c1c6e7 /src/numeric.c | |
| parent | 6af0effda1b16c1137ca31f94c87976a7e13b637 (diff) | |
| download | mruby-752edf413f09fb3e78d79ca7d752ae5dc2e25c02.tar.gz mruby-752edf413f09fb3e78d79ca7d752ae5dc2e25c02.zip | |
Terminate float right shift if shift value is too big.
Diffstat (limited to 'src/numeric.c')
| -rw-r--r-- | src/numeric.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/numeric.c b/src/numeric.c index 101b338de..5dbf9df22 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -484,6 +484,10 @@ flo_shift(mrb_state *mrb, mrb_value x, mrb_int width) if (width < 0) { while (width++) { val /= 2; + if (val < 1.0) { + val = 0; + break; + } } #if defined(_ISOC99_SOURCE) val = trunc(val); |
