aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parseTools.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index acb5c9cd..abc59a5a 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1487,12 +1487,15 @@ function makeSignOp(value, type, op, force) {
return '((' + value + ')|0)';
} else {
return '((' + value + ')>>>0)';
+ // Alternatively, we can consider the lengthier
+ // return makeInlineCalculation('VALUE >= 0 ? VALUE : ' + Math.pow(2, bits) + ' + VALUE', value, 'tempBigInt');
+ // which does not always turn us into a 32-bit *un*signed value
}
} else if (bits < 32) {
- if (op === 'un') {
- return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')';
- } else {
+ if (op === 're') {
return makeInlineCalculation('VALUE >= ' + Math.pow(2, bits-1) + ' ? VALUE-' + Math.pow(2, bits) + ' : VALUE', value, 'tempInt');
+ } else {
+ return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')';
}
}
}