aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2011-02-27 20:36:30 -0800
committerAlon Zakai <azakai@mozilla.com>2011-02-27 20:36:30 -0800
commit9feb459b526a71962d9459094e4e426e031f5591 (patch)
treeb247e1e1726103e04d2558adc0f21c16d06c652d /src
parent6b7f4ffa844bd3e1f2690af2501807e1da161034 (diff)
comments
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 5f0f11c6..0c7e56be 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -851,7 +851,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
case 'fdiv': return ident1 + ' / ' + ident2;
case 'fmul': return ident1 + ' * ' + ident2;
case 'uitofp': case 'sitofp': return ident1;
- case 'fptoui': case 'fptosi': return 'Math.floor(' + ident1 + ')';
+ case 'fptoui': case 'fptosi': return 'Math.floor(' + ident1 + ')'; // Note that this is different than C/C++ style rounding - they
+ // round -2.75 to -2 and +2.75 to +2, in other words, they
+ // floor the absolute value then restore the sign. JS doesn't
+ // have a fast operator to do that
// TODO: We sometimes generate false instead of 0, etc., in the *cmps. It seemed slightly faster before, but worth rechecking
// Note that with typed arrays, these become 0 when written. So that is a potential difference with non-typed array runs.