aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/shared.py')
-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: