diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 18:09:47 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 18:09:47 -0700 |
commit | 866039dc1f1c880399d3819a1194350d78c12a33 (patch) | |
tree | c96b6b84cfa00fae75f763bff79666075f58fc32 | |
parent | c9cd4323d8091da25c1a2e84aa5e27033a97b590 (diff) |
do not send floats to ffis
-rw-r--r-- | src/modules.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules.js b/src/modules.js index 2e6edeba..dd622bee 100644 --- a/src/modules.js +++ b/src/modules.js @@ -372,8 +372,9 @@ var Functions = { } for (var j = 1; j < t.length; j++) { args += (j > 1 ? ',' : '') + 'a' + j; - arg_coercions += 'a' + j + '=' + asmCoercion('a' + j, Functions.getSignatureType(t[j])) + ';'; - call += (j > 1 ? ',' : '') + asmCoercion('a' + j, Functions.getSignatureType(t[j])); + var type = Functions.getSignatureType(t[j]); + arg_coercions += 'a' + j + '=' + asmCoercion('a' + j, type) + ';'; + call += (j > 1 ? ',' : '') + asmCoercion('a' + j, type === 'float' ? 'double' : type); // ffi arguments must be doubles if they are floats } call += ')'; if (short == '_setjmp') printErr('WARNING: setjmp used via a function pointer. If this is for libc setjmp (not something of your own with the same name), it will break things'); |