File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -997,6 +997,15 @@ function makeVarDef(js) {
997997 return js ;
998998}
999999
1000+ function asmEnsureFloat ( value , type ) { // ensures that a float type has either 5.5 (clearly a float) or +5 (float due to asm coercion)
1001+ if ( ! ASM_JS ) return value ;
1002+ if ( ! isIntImplemented ( type ) && isNumber ( value ) && value . toString ( ) . indexOf ( '.' ) < 0 ) {
1003+ return '(+(' + value + '))' ;
1004+ } else {
1005+ return value ;
1006+ }
1007+ }
1008+
10001009function asmInitializer ( type , impl ) {
10011010 if ( isIntImplemented ( type ) ) { // || (impl && impl == 'VAR_EMULATED')) {
10021011 return '0' ;
@@ -2097,7 +2106,7 @@ function processMathop(item) {
20972106 // then unsigning that i32... which would give something huge.
20982107 case 'zext' : case 'fpext' : case 'sext' : return idents [ 0 ] ;
20992108 case 'fptrunc' : return idents [ 0 ] ;
2100- case 'select' : return idents [ 0 ] + ' ? ' + idents [ 1 ] + ' : ' + idents [ 2 ] ;
2109+ case 'select' : return idents [ 0 ] + ' ? ' + asmEnsureFloat ( idents [ 1 ] , item . type ) + ' : ' + asmEnsureFloat ( idents [ 2 ] , item . type ) ;
21012110 case 'ptrtoint' : case 'inttoptr' : {
21022111 var ret = '' ;
21032112 if ( QUANTUM_SIZE == 1 ) {
You can’t perform that action at this time.
0 commit comments