diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-28 14:41:46 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-28 14:41:46 -0800 |
commit | ab12dc1380d89298f289215087ee94a65e37acca (patch) | |
tree | 42e7d5000fd36056cef88f0d91aa8ef9a67fbc63 /tools/js-optimizer.js | |
parent | 6b83482d32375fb6852cd34150890e57460d8645 (diff) |
fix optimizeShifts bug
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r-- | tools/js-optimizer.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 150b1c37..6cd1fbcc 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -527,6 +527,10 @@ function optimizeShifts(ast) { var total = 0; if (node[3][0] == 'num' && node[2][3][0] == 'num') { total = ['num', sign1*node[3][1] + sign2*node[2][3][1]]; + if (total[1] < 0) { + combinedShift = '<<'; + total[1] *= -1; + } if (total[1] == 0) { // XXX this may be wrong, if we removed a |0 that assumed we had this >> which |0's anyhow! return node[2][2]; |