aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-24 18:11:55 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-24 18:11:55 -0800
commite3c6c8170a423d69d689a60570f3167d0162cef3 (patch)
treec344f06ea12c34a52408daac0b53ca67e4532217 /src/runtime.js
parentbacb70a2ec81b64ecf7bb2e838a3d3423746deea (diff)
fix some i64 printing rounding errors
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime.js b/src/runtime.js
index 495e72dd..6f17028a 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -79,9 +79,9 @@ 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) {
- return '((' + unsigned + ' || (' + makeSignOp(high, 'i32', 're', 1, 1) + ' >= 0))' +
+ return '(' + unsigned +
' ? (' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 'un', 1, 1) + '*4294967296))' +
- ' : (' + makeSignOp(low, 'i32', 're', 1, 1) + '+(1+' + makeSignOp(high, 'i32', 're', 1, 1) + ')*4294967296))';
+ ' : (' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 're', 1, 1) + '*4294967296)))';
}
};