diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-23 16:21:58 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-23 16:21:58 -0800 |
commit | 8e3db359576baa9d22ee6d96da6f5d48b1ee8d00 (patch) | |
tree | 25611a733078d2aab17241d910571ba47331415a /src/parseTools.js | |
parent | 88aa815ec43d009cc4d27a150c30373632265a51 (diff) |
fix unaligned reads
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 1b7941b2..5b2df3a0 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -920,14 +920,12 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa if (isIntImplemented(type)) { if (bytes <= 4) { for (var i = 0; i < bytes; i++) { - ret += 'tempInt' + (i == 0 ? '=' : (i < bytes-1 ? '+=((' : '+((')); + ret += 'tempInt' + (i == 0 ? '=' : '|=(('); ret += makeGetValue(ptr, getFastValue(pos, '+', i), 'i8', noNeedFirst, 1, ignore); if (i > 0) ret += ')<<' + (8*i) + ')'; - if (i < bytes-1) ret += ','; - } - if (!unsigned) { - ret += ',' + makeSignOp('tempInt', type, 're', true); + ret += ','; } + ret += makeSignOp('tempInt', type, unsigned ? 'un' : 're', true); } else { assert(bytes == 8); ret += 'tempBigInt=' + makeGetValue(ptr, pos, 'i32', noNeedFirst, true, ignore, align) + ','; |