File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -547,17 +547,6 @@ function charCode(char) {
547547 return char . charCodeAt ( 0 ) ;
548548}
549549
550- function ensureValidFFIType ( type ) {
551- return type === 'float' ? 'double' : type ; // ffi does not tolerate float XXX
552- }
553-
554- // FFI return values must arrive as doubles, and we can force them to floats afterwards
555- function asmFFICoercion ( value , type ) {
556- value = asmCoercion ( value , ensureValidFFIType ( type ) ) ;
557- if ( type === 'float' ) value = asmCoercion ( value , 'float' ) ;
558- return value ;
559- }
560-
561550function makeDynCall ( sig , funcPtr ) {
562551 assert ( ! sig . includes ( 'j' ) , 'Cannot specify 64-bit signatures ("j" in signature string) with makeDynCall!' ) ;
563552
Original file line number Diff line number Diff line change @@ -121,3 +121,14 @@ function addAtMain(code) {
121121 assert ( HAS_MAIN , 'addAtMain called but program has no main function' ) ;
122122 ATMAINS . push ( code ) ;
123123}
124+
125+ function ensureValidFFIType ( type ) {
126+ return type === 'float' ? 'double' : type ; // ffi does not tolerate float XXX
127+ }
128+
129+ // FFI return values must arrive as doubles, and we can force them to floats afterwards
130+ function asmFFICoercion ( value , type ) {
131+ value = asmCoercion ( value , ensureValidFFIType ( type ) ) ;
132+ if ( type === 'float' ) value = asmCoercion ( value , 'float' ) ;
133+ return value ;
134+ }
You can’t perform that action at this time.
0 commit comments