aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-12 16:32:07 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-12 16:32:07 -0800
commit2aa6d93eddceca6d908e4903ce55952180c7d40d (patch)
tree63b8b609c69132cd4bad11c595d45da40b2d5dcd
parentb7736cf61e5b216d2c9eaad4b0440321ebcd4999 (diff)
make explicit double multiplying of ints in int multiply
-rw-r--r--src/parseTools.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 36d62204..c297b278 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1972,6 +1972,11 @@ function processMathop(item) {
Types.preciseI64MathUsed = true;
return '(i64Math' + (ASM_JS ? '_' : '.') + 'multiply(' + idents[0] + ',0,' + idents[1] + ',0),' + makeGetValue('tempDoublePtr', 0, 'i32') + ')';
} else {
+ if (ASM_JS) {
+ // special-case: there is no integer multiply in asm, because there is no true integer
+ // multiply in JS. While we wait for Math.imul, do double multiply
+ return '(~~(+' + idents[0] + ' * +' + idents[1] + '))';
+ }
return handleOverflow(getFastValue(idents[0], '*', idents[1], item.type), bits);
}
}