diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 13:29:00 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 13:29:00 -0700 |
commit | 96b514ca183befe9bd800ce16f33a61c5f971627 (patch) | |
tree | 5c1fe366dae438141f3313da890bba9eb5c73c70 /src/parseTools.js | |
parent | 3ff3a402d58a8c33151d6ce6767d34cb5bc9cc29 (diff) |
use fround in asm initializers and coercions
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 2272c851..14683bf6 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1194,11 +1194,9 @@ function asmEnsureFloat(value, type) { // ensures that a float type has either 5 function asmInitializer(type, impl) { if (type in Runtime.FLOAT_TYPES) { - if (RUNNING_JS_OPTS) { - return '+0'; - } else { - return '.0'; - } + var ret = RUNNING_JS_OPTS ? '+0' : '.0'; + if (FROUND && type === 'float') ret = 'Math_fround(' + ret + ')'; + return ret; } else { return '0'; } @@ -1219,7 +1217,11 @@ function asmCoercion(value, type, signedness) { value = '(' + value + ')|0'; } } - return '(+(' + value + '))'; + if (FROUND && type === 'float') { + return 'Math_fround(' + value + ')'; + } else { + return '(+(' + value + '))'; + } } } else { return '((' + value + ')|0)'; |