aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-05-24 07:33:53 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-05-24 07:33:53 -0700
commit77cacaa2fd27bcc1265f2f7255b18c3461e0ddff (patch)
tree83ef0b674533d8e9171b4b6ac786d88b6627babb /src
parent608c3ce208f406b172f98272710df0032088a248 (diff)
handle shifts with more than 32 bits
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 774293d0..bc83e4ea 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -931,10 +931,17 @@ function processMathop(item) { with(item) {
}
}
*/
+ if (bits > 32) return ident1 + '*Math.pow(2,' + ident2 + ')';
return ident1 + ' << ' + ident2;
}
- case 'ashr': return ident1 + ' >> ' + ident2;
- case 'lshr': return ident1 + ' >>> ' + ident2;
+ case 'ashr': {
+ if (bits > 32) return ident1 + '/Math.pow(2,' + ident2 + ')';
+ return ident1 + ' >> ' + ident2;
+ }
+ case 'lshr': {
+ if (bits > 32) return ident1 + '/Math.pow(2,' + ident2 + ')';
+ return ident1 + ' >>> ' + ident2;
+ }
// basic float ops
case 'fadd': return ident1 + ' + ' + ident2;
case 'fsub': return ident1 + ' - ' + ident2;