aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-03-21 19:50:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-03-21 19:50:03 -0700
commitb956a15fb40aa661c7feb0f8b078f1bb0ea1d622 (patch)
tree6b8a457060fd2765232d0d3705fde59f674383cc /src
parent24856d20699818b35f01963e4144c87d1a5c56ff (diff)
poppler-related tweaks
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 7a7bc47f..2e525649 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -803,7 +803,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
// TODO: figure out something here along the lines of return '(' + Math.pow(2, 32) + '+((' + value + ')|0))';
}
}
- return op + 'Sign(' + value + ', ' + bits + ', ' + correctSpecificSign() + ')'; // If we are correcting a specific sign here, do not check for it
+ return op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(correctSpecificSign()) + ')'; // If we are correcting a specific sign here, do not check for it
} else {
return value;
}
diff --git a/src/library.js b/src/library.js
index 08daceb1..54834d17 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1253,10 +1253,18 @@ function reSign(value, bits, ignore) {
: Math.pow(2, bits-1);
if (value >= half) {
#if CHECK_SIGNS
- if (!ignore) CorrectionsMonitor.note('ReSign');
+ if (!ignore) CorrectionsMonitor.note('ReSign');
#endif
value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
}
+#if CHECK_SIGNS
+ // If this is a 32-bit value, then it should be corrected at this point. And,
+ // without CHECK_SIGNS, we would just do the |0 shortcut, so check that that
+ // would indeed give the exact same result.
+ if (bits === 32 && (value|0) !== value && typeof value !== 'boolean') {
+ CorrectionsMonitor.note('ReSign');
+ }
+#endif
return value;
}