diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-11-27 12:45:00 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-11-27 12:45:00 -0800 |
commit | b61f32f98dbedccc518d7dcabbf6f4505020cfee (patch) | |
tree | c506ac3929ab3bc4d5b700e5e3df51dae3c2a0ce /src/parseTools.js | |
parent | 17ee516bcd20561dc1badef8a6812f7d1d99a550 (diff) |
fix for i64 mode 1 conversion of double to i64
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 57765ac2..3b4e8df4 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -576,7 +576,7 @@ function makeI64(low, high) { // Splits a number (an integer in a double, possibly > 32 bits) into an I64_MODE 1 i64 value. // Will suffer from rounding. margeI64 does the opposite. -// TODO: optimize I64 calcs +// TODO: optimize I64 calcs. For example, saving their parts as signed 32 as opposed to unsigned would help function splitI64(value) { assert(I64_MODE == 1); return makeInlineCalculation(makeI64('VALUE>>>0', 'Math.floor(VALUE/4294967296)'), value, 'tempBigInt'); @@ -1590,7 +1590,7 @@ function processMathop(item) { with(item) { return makeInlineCalculation('VALUE-VALUE%1', value, 'tempBigInt'); } - if ((type == 'i64' || paramTypes[0] == 'i64' || paramTypes[1] == 'i64') && I64_MODE == 1) { + if ((type == 'i64' || paramTypes[0] == 'i64' || paramTypes[1] == 'i64' || ident2 == '(i64)') && I64_MODE == 1) { function warnI64_1() { warnOnce('Arithmetic on 64-bit integers in mode 1 is rounded and flaky, like mode 0, but much slower!'); } @@ -1618,6 +1618,7 @@ function processMathop(item) { with(item) { ident1 + '[1] >>> ' + ident2 + ']'; } case 'uitofp': case 'sitofp': return ident1 + '[0] + ' + ident1 + '[1]*4294967296'; + case 'fptoui': case 'fptosi': return splitI64(ident1); case 'icmp': { switch (variant) { case 'uge': case 'sge': return ident1 + '[1] >= ' + ident2 + '[1] && (' + ident1 + '[1] > ' + ident2 + '[1] || ' + |