aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-06-11 10:32:16 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-06-11 10:32:16 -0700
commitccab86082893ff9120bdfbe8be490cd43ecf2cf3 (patch)
treee6b7e12f96134444afcb78574576dfc61e8a92cc /src/parseTools.js
parent399d78d9c2663e0b2ce874bf30e9b7993f231f06 (diff)
always sign/unsign constants at compile time
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 2e5e109d..167ba074 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1014,13 +1014,19 @@ function finalizeLLVMParameter(param) {
function makeSignOp(value, type, op) {
if (!value) return value;
- if (!correctSigns() && !CHECK_SIGNS) return value;
+ var bits, full;
if (type in Runtime.INT_TYPES) {
- var bits = parseInt(type.substr(1));
+ bits = parseInt(type.substr(1));
+ full = op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(correctSpecificSign() && !AUTO_OPTIMIZE) + (
+ AUTO_OPTIMIZE ? ', "' + Debugging.getIdentifier(Framework.currItem.lineNum) + '"' : ''
+ ) + ')';
+ // Always sign/unsign constants at compile time, regardless of CHECK/CORRECT
if (isNumber(value)) {
- // Sign/unsign constants at compile time
- return eval(op + 'Sign(' + value + ', ' + bits + ', 1)').toString();
+ return eval(full).toString();
}
+ }
+ if (!correctSigns() && !CHECK_SIGNS) return value;
+ if (type in Runtime.INT_TYPES) {
// shortcuts for 32-bit case
if (bits === 32 && !CHECK_SIGNS) {
if (op === 're') {
@@ -1029,12 +1035,9 @@ function makeSignOp(value, type, op) {
return '((' + value + ')>>>0)';
}
}
- return op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(correctSpecificSign() && !AUTO_OPTIMIZE) + (
- AUTO_OPTIMIZE ? ', "' + Debugging.getIdentifier(Framework.currItem.lineNum) + '"' : ''
- ) + ')'; // If we are correcting a specific sign here, do not check for it
- } else {
- return value;
+ return full;
}
+ return value;
}
function makeRounding(value, bits, signed) {