diff options
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime.js b/src/runtime.js index d1475bd4..43bd7de1 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -46,7 +46,7 @@ var RuntimeGenerator = { ret += '; assert(STACKTOP < STACK_MAX)'; } if (INIT_STACK) { - ret += '; _memset(__stackBase__, 0, ' + initial + ')'; + ret += '; _memset(' + asmCoercion('__stackBase__', 'i32') + ', 0, ' + initial + ')'; } return ret; }, @@ -79,8 +79,8 @@ var RuntimeGenerator = { // Rounding is inevitable if the number is large. This is a particular problem for small negative numbers // (-1 will be rounded!), so handle negatives separately and carefully makeBigInt: function(low, high, unsigned) { - var unsignedRet = '(' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 'un', 1, 1) + '*4294967296))'; - var signedRet = '(' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 're', 1, 1) + '*4294967296))'; + var unsignedRet = '(' + asmCoercion(makeSignOp(low, 'i32', 'un', 1, 1), 'float') + '+(' + asmCoercion(makeSignOp(high, 'i32', 'un', 1, 1), 'float') + '*' + asmEnsureFloat(4294967296, 'float') + '))'; + var signedRet = '(' + asmCoercion(makeSignOp(low, 'i32', 'un', 1, 1), 'float') + '+(' + asmCoercion(makeSignOp(high, 'i32', 're', 1, 1), 'float') + '*' + asmEnsureFloat(4294967296, 'float') + '))'; if (typeof unsigned === 'string') return '(' + unsigned + ' ? ' + unsignedRet + ' : ' + signedRet + ')'; return unsigned ? unsignedRet : signedRet; } @@ -334,6 +334,7 @@ var Runtime = { assert(args.length == sig.length-1); #endif #if ASM_JS + if (!args.splice) args = Array.prototype.slice.call(args); args.splice(0, 0, ptr); return Module['dynCall_' + sig].apply(null, args); #else |