aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parseTools.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index c3917e37..aa1c37b1 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1461,6 +1461,7 @@ function finalizeLLVMParameter(param, noIndexizeFunctions) {
}
function makeSignOp(value, type, op, force) {
+ // XXX this is not quite right. both parts should always be unsigned (or, perhaps always signed, we should move to that - separate issue though)
if (I64_MODE == 1 && type == 'i64') {
return '(tempPair=' + value + ',[' + makeSignOp('tempPair[0]', 'i32', op, force) + ',' + makeSignOp('tempPair[1]', 'i32', op, force) + '])';
}
@@ -1497,6 +1498,12 @@ function makeSignOp(value, type, op, force) {
} else {
return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')';
}
+ } else { // bits > 32
+ if (op === 're') {
+ return makeInlineCalculation('VALUE >= ' + Math.pow(2, bits-1) + ' ? VALUE-' + Math.pow(2, bits) + ' : VALUE', value, 'tempBigInt');
+ } else {
+ return makeInlineCalculation('VALUE >= 0 ? VALUE : ' + Math.pow(2, bits) + '+VALUE', value, 'tempBigInt');
+ }
}
}
return full;