aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-02 13:48:11 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-02 13:48:11 -0700
commit2308587a85de571844e71e574fcc63c7955d6012 (patch)
tree2473d987163146e7bc1278031444c50b1da7aead /tools
parent9fd0afa69c6c088fb80c2e2611cc45301fdc99ef (diff)
handle floats in jsCall properly; fixes asm2f.test_embind_2
Diffstat (limited to 'tools')
-rw-r--r--tools/shared.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 82bdd98b..826baa83 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1650,12 +1650,17 @@ class JS:
return '+0'
@staticmethod
- def make_coercion(value, sig, settings=None):
+ def make_coercion(value, sig, settings=None, ffi_arg=False, ffi_result=False):
settings = settings or Settings
if sig == 'i':
return value + '|0'
elif sig == 'f' and settings.get('PRECISE_F32'):
- return 'Math_fround(' + value + ')'
+ if ffi_arg:
+ return '+Math_fround(' + value + ')'
+ elif ffi_result:
+ return 'Math_fround(+(' + value + '))'
+ else:
+ return 'Math_fround(' + value + ')'
elif sig == 'd' or sig == 'f':
return '+' + value
else: