aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js6
-rw-r--r--src/preamble.js2
-rw-r--r--src/settings.js1
3 files changed, 4 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 15c2169b..514d74d0 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1046,10 +1046,8 @@ function asmMultiplyI32(a, b) {
if ((isNumber(a) && Math.abs(a) < TWO_TWENTY) || (isNumber(b) && Math.abs(b) < TWO_TWENTY)) {
return '(((' + a + ')*(' + b + '))&-1)'; // small enough to emit directly as a multiply
}
- if (USE_MATH_IMUL) {
- return 'Math.imul(' + a + ',' + b + ')';
- }
- return '(~~(+((' + a + ')|0) * +((' + b + ')|0)))';
+ return 'Math.imul(' + a + ',' + b + ')';
+ // non-imul version: return '(~~(+((' + a + ')|0) * +((' + b + ')|0)))';
}
function asmFloatToInt(x) {
diff --git a/src/preamble.js b/src/preamble.js
index 503b09f1..b355f130 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -742,6 +742,8 @@ Module['writeArrayToMemory'] = writeArrayToMemory;
{{{ unSign }}}
{{{ reSign }}}
+if (!Math.imul) Math.imul = function(x, y) { return (x*y)|0 }; // # not a real polyfill since semantics not identical, but close and fast
+
// A counter of dependencies for calling run(). If we need to
// do asynchronous work before running, increment this and
// decrement it. Incrementing must happen in a place like
diff --git a/src/settings.js b/src/settings.js
index f4e23c5b..1023ee11 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -325,7 +325,6 @@ var BENCHMARK = 0; // If 1, will just time how long main() takes to execute, and
var ASM_JS = 0; // If 1, generate code in asm.js format. XXX This is highly experimental,
// and will not work on most codebases yet. It is NOT recommended that you
// try this yet.
-var USE_MATH_IMUL = 1; // If 1, use Math.imul when normal int math can't be done in ASM_JS
var EXPLICIT_ZEXT = 0; // If 1, generate an explicit conversion of zext i1 to i32, using ?: