aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-22 18:41:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-02-22 18:55:13 -0800
commitc00e097d60100c7a562ac25664eb3c25bb9403ae (patch)
treef724c92e09a6c24c85110a33fc40561a2b0dcbb4 /emscripten.py
parent90710c0c8ee4425c06402cc7831abdee8c519a43 (diff)
always use Math.imul, with fast polyfill. will be useful for faster 64-bit math
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/emscripten.py b/emscripten.py
index af762a21..b3e153c1 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -322,10 +322,7 @@ def emscript(infile, settings, outfile, libraries=[]):
function_tables_defs = '\n'.join([info[0] for info in infos] + [info[1] for info in infos])
asm_setup = ''
- maths = ['Math.' + func for func in ['floor', 'abs', 'sqrt', 'pow', 'cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'atan2', 'exp', 'log', 'ceil']]
- if settings['USE_MATH_IMUL']:
- maths += ['Math.imul']
- asm_setup += 'if (!Math.imul) Math.imul = function(x, y) { return (x*y)|0 }; // # not a real polyfill since semantics not identical, but close and fairly fast\n'
+ maths = ['Math.' + func for func in ['floor', 'abs', 'sqrt', 'pow', 'cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'atan2', 'exp', 'log', 'ceil', 'imul']]
fundamentals = ['Math', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint16Array', 'Uint32Array', 'Float32Array', 'Float64Array']
math_envs = ['Runtime.bitshift64', 'Math.min'] # TODO: move min to maths
asm_setup += '\n'.join(['var %s = %s;' % (f.replace('.', '_'), f) for f in math_envs])