handle floats in jsCall properly; fixes asm2f.test_embind_2
This commit is contained in:
Родитель
9fd0afa69c
Коммит
2308587a85
|
@ -1076,8 +1076,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
|
|||
}
|
||||
''' % (sig, ',' if len(sig) > 1 else '', args, arg_coercions, ret))
|
||||
|
||||
ffi_args = ','.join([shared.JS.make_coercion('a' + str(i), sig[i], settings, ffi_arg=True) for i in range(1, len(sig))])
|
||||
for i in range(settings['RESERVED_FUNCTION_POINTERS']):
|
||||
jsret = ('return ' if sig[0] != 'v' else '') + shared.JS.make_coercion('jsCall(%d%s%s)' % (i, ',' if coerced_args else '', coerced_args), sig[0], settings)
|
||||
jsret = ('return ' if sig[0] != 'v' else '') + shared.JS.make_coercion('jsCall(%d%s%s)' % (i, ',' if ffi_args else '', ffi_args), sig[0], settings, ffi_result=True)
|
||||
function_tables_impls.append('''
|
||||
function jsCall_%s_%s(%s) {
|
||||
%s
|
||||
|
|
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче