aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-26 17:28:28 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-26 17:28:28 -0800
commit096a45f92f2bd56eeb762424de3b3feb904b7641 (patch)
tree0cb4ac2891cb312dbf98afea146b27a984faac1a
parent8c9b89833a09980f64bba918d68288f4e51db596 (diff)
optimize resigning of <32 bit ints
-rw-r--r--src/parseTools.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index abc59a5a..c3917e37 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1493,7 +1493,7 @@ function makeSignOp(value, type, op, force) {
}
} else if (bits < 32) {
if (op === 're') {
- return makeInlineCalculation('VALUE >= ' + Math.pow(2, bits-1) + ' ? VALUE-' + Math.pow(2, bits) + ' : VALUE', value, 'tempInt');
+ return makeInlineCalculation('(VALUE << ' + (32-bits) + ') >> ' + (32-bits), value, 'tempInt');
} else {
return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')';
}