diff options
author | Alon Zakai <azakai@google.com> | 2020-07-22 15:14:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-22 15:14:01 -0700 |
commit | 3ac849384aa861382d2ca9636a89556e237e55d6 (patch) | |
tree | 2ed179d80c70bb53771a84bd014483d7b91cae53 /src | |
parent | d406654f7cd6249277a2eef542c883603b4b3b53 (diff) | |
download | binaryen-3ac849384aa861382d2ca9636a89556e237e55d6.tar.gz binaryen-3ac849384aa861382d2ca9636a89556e237e55d6.tar.bz2 binaryen-3ac849384aa861382d2ca9636a89556e237e55d6.zip |
Fix i32.trunc_f64_u of values that round down to UINT32_MAX (#2976)
Diffstat (limited to 'src')
-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 4afc7afea..d99508b17 100644 --- a/src/support/safe_integer.cpp +++ b/src/support/safe_integer.cpp @@ -125,7 +125,7 @@ bool wasm::isInRangeI64TruncU(int32_t i) { * --------------------------------- * 0 00000000000 0000...000000...000 0x0000000000000000 => 0 * 0 10000011101 1111...111000...111 0x41dfffffffffffff => 2147483647.9999998 (rounds down to INT32_MAX) - * 0 10000011110 1111...111100...000 0x41efffffffe00000 => 4294967295 (UINT32_MAX) + * 0 10000011110 1111...111111...111 0x41efffffffffffff => 4294967295.9999995 (rounds down to UINT32_MAX) * 0 10000111101 1111...111111...111 0x43dfffffffffffff => 9223372036854774784 (~INT64_MAX) * 0 10000111110 0000...000000...000 0x43e0000000000000 => 9223372036854775808 * 0 10000111110 1111...111111...111 0x43efffffffffffff => 18446744073709549568 (~UINT64_MAX) @@ -152,7 +152,7 @@ bool wasm::isInRangeI32TruncS(int64_t i) { bool wasm::isInRangeI32TruncU(int64_t i) { uint64_t u = i; - return (u <= 0x41efffffffe00000ULL) || + return (u <= 0x41efffffffffffffULL) || (u >= 0x8000000000000000ULL && u <= 0xbfefffffffffffffULL); } |