diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-02-10 21:14:31 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-02-10 21:14:31 -0800 |
commit | c21d0b14b1e5e94c82549926b2f5e7a68e291895 (patch) | |
tree | 231b7f72d493183431a380e5f5aacff3d2791a3b /src | |
parent | 837ac371eaa356ba381ed01a872c56a8245669f8 (diff) | |
parent | 7b778798f1bbecfd95ff65ea94317957e79b9ee7 (diff) | |
download | binaryen-c21d0b14b1e5e94c82549926b2f5e7a68e291895.tar.gz binaryen-c21d0b14b1e5e94c82549926b2f5e7a68e291895.tar.bz2 binaryen-c21d0b14b1e5e94c82549926b2f5e7a68e291895.zip |
Merge pull request #194 from WebAssembly/store-parsing
Store parsing fix
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 6 | ||||
-rw-r--r-- | src/wasm.h | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index ac62046d8..5557cc2ff 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -21,6 +21,8 @@ #ifndef wasm_s2wasm_h #define wasm_s2wasm_h +#include <limits.h> + #include "wasm.h" #include "parsing.h" #include "asm_v_wasm.h" @@ -649,7 +651,7 @@ class S2WasmBuilder { skipComma(); auto curr = allocator.alloc<Load>(); curr->type = type; - int32_t bytes = getInt()/8; + int32_t bytes = getInt() / CHAR_BIT; curr->bytes = bytes > 0 ? bytes : getWasmTypeSize(type); curr->signed_ = match("_s"); match("_u"); @@ -669,7 +671,7 @@ class S2WasmBuilder { skipComma(); auto curr = allocator.alloc<Store>(); curr->type = type; - int32_t bytes = getInt(); + int32_t bytes = getInt() / CHAR_BIT; curr->bytes = bytes > 0 ? bytes : getWasmTypeSize(type); Name assign = getAssign(); getConst(&curr->offset); diff --git a/src/wasm.h b/src/wasm.h index e30a891b9..8701bd2f4 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -758,11 +758,13 @@ public: std::ostream& doPrint(std::ostream &o, unsigned indent) { o << '('; prepareColor(o) << printWasmType(type) << ".store"; - if (bytes < 4) { + if (bytes < 4 || (type == i64 && bytes < 8)) { if (bytes == 1) { o << '8'; } else if (bytes == 2) { o << "16"; + } else if (bytes == 4) { + o << "32"; } else { abort(); } |