diff options
author | Alon Zakai <azakai@google.com> | 2020-07-22 06:53:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-22 06:53:15 -0700 |
commit | 86362be31f1ae2d65e03fcc28bbf6526e48242f7 (patch) | |
tree | 75ec36ccce330981156f2e3d0ca5bc0538c3dcb3 /src/support/safe_integer.cpp | |
parent | 481e3eeade76a07a250979e2fbe0072d2662fe7d (diff) | |
download | binaryen-86362be31f1ae2d65e03fcc28bbf6526e48242f7.tar.gz binaryen-86362be31f1ae2d65e03fcc28bbf6526e48242f7.tar.bz2 binaryen-86362be31f1ae2d65e03fcc28bbf6526e48242f7.zip |
Fix i32.trunc_f64_s of values that round up to INT32_MIN (#2975)
See WebAssembly/spec#1224
Diffstat (limited to 'src/support/safe_integer.cpp')
-rw-r--r-- | src/support/safe_integer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/support/safe_integer.cpp b/src/support/safe_integer.cpp index 9b6b56be0..4afc7afea 100644 --- a/src/support/safe_integer.cpp +++ b/src/support/safe_integer.cpp @@ -136,7 +136,7 @@ bool wasm::isInRangeI64TruncU(int32_t i) { * 1 00000000000 0000...000000...000 0x8000000000000000 => -0 * 1 01111111110 1111...111111...111 0xbfefffffffffffff => -1 + ulp (~UINT32_MIN, ~UINT64_MIN) * 1 01111111111 0000...000000...000 0xbff0000000000000 => -1 - * 1 10000011110 0000...000000...000 0xc1e0000000000000 => -2147483648 (INT32_MIN) + * 1 10000011110 0000...000000...111 0xc1e00000001fffff => -2147483648.9999995 (rounds up to INT32_MIN) * 1 10000111110 0000...000000...000 0xc3e0000000000000 => -9223372036854775808 (INT64_MIN) * 1 11111111111 0000...000000...000 0xfff0000000000000 => -inf * 1 11111111111 0000...000000...001 0xfff0000000000001 => -nan(0x1) @@ -147,7 +147,7 @@ bool wasm::isInRangeI64TruncU(int32_t i) { bool wasm::isInRangeI32TruncS(int64_t i) { uint64_t u = i; return (u <= 0x41dfffffffffffffULL) || - (u >= 0x8000000000000000ULL && u <= 0xc1e0000000000000ULL); + (u >= 0x8000000000000000ULL && u <= 0xc1e00000001fffffULL); } bool wasm::isInRangeI32TruncU(int64_t i) { |