aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-13 10:20:23 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-13 10:20:23 -0700
commit3dba21acf3bbbdf448bf79ef2794f12eb5c92a97 (patch)
treeb0e24f66c53bb856632940f7299740a2aae70fcf
parentef124013a59d1a9727aa057d48e0e3cbea0d2de9 (diff)
do not do some unnecessary signing/unsigning
-rw-r--r--src/parseTools.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 350083e6..73d7e647 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1162,6 +1162,8 @@ function processMathop(item) { with(item) {
item['ident'+i] = null; // just so it exists for purposes of reading ident2 etc. later on, and no exception is thrown
}
}
+ var originalIdent1 = ident1;
+ var originalIdent2 = ident2;
if (isUnsignedOp(op, variant)) {
ident1 = makeSignOp(ident1, paramTypes[0], 'un');
ident2 = makeSignOp(ident2, paramTypes[1], 'un');
@@ -1227,10 +1229,12 @@ function processMathop(item) { with(item) {
}
case 'ashr': {
if (bits > 32) return integerizeBignum(ident1 + '/Math.pow(2,' + ident2 + ')');
+ if (bits === 32) return originalIdent1 + ' >> ' + ident2; // No need to reSign in this case
return ident1 + ' >> ' + ident2;
}
case 'lshr': {
if (bits > 32) return integerizeBignum(ident1 + '/Math.pow(2,' + ident2 + ')');
+ if (bits === 32) return originalIdent1 + ' >>> ' + ident2; // No need to unSign in this case
return ident1 + ' >>> ' + ident2;
}
// basic float ops