diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-01-29 20:32:04 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-01-29 20:32:04 -0800 |
commit | 4a182068c6f3360dbf9c27420bbb0a11f34af3dd (patch) | |
tree | 7e92a9caf48e3caf9945db93c76c48a24ad47554 /src/wasm.h | |
parent | 6d8015094f49f5403d9b9a54bab694e41014cc2a (diff) | |
parent | fece87ba4008c20978639580a8dc7264c57c489d (diff) | |
download | binaryen-4a182068c6f3360dbf9c27420bbb0a11f34af3dd.tar.gz binaryen-4a182068c6f3360dbf9c27420bbb0a11f34af3dd.tar.bz2 binaryen-4a182068c6f3360dbf9c27420bbb0a11f34af3dd.zip |
Merge pull request #153 from WebAssembly/binary-spec-tests
Binary spec tests
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/wasm.h b/src/wasm.h index 97e0bfc12..528e9c0b0 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -193,7 +193,7 @@ struct Literal { if (isnan(f)) { const char *sign = std::signbit(f) ? "-" : ""; o << sign << "nan"; - if (uint32_t payload = ~0xffc00000u & bit_cast<uint32_t>(f)) { + if (uint32_t payload = ~0xff800000u & bit_cast<uint32_t>(f)) { o << ":0x" << std::hex << payload << std::dec; } return; @@ -209,7 +209,7 @@ struct Literal { if (isnan(d)) { const char *sign = std::signbit(d) ? "-" : ""; o << sign << "nan"; - if (uint64_t payload = ~0xfff8000000000000ull & bit_cast<uint64_t>(d)) { + if (uint64_t payload = ~0xfff0000000000000ull & bit_cast<uint64_t>(d)) { o << ":0x" << std::hex << payload << std::dec; } return; @@ -676,11 +676,13 @@ public: std::ostream& doPrint(std::ostream &o, unsigned indent) { o << '('; prepareColor(o) << printWasmType(type) << ".load"; - 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(); } @@ -954,6 +956,9 @@ public: std::ostream& print(std::ostream &o, unsigned indent) { printOpening(o, "func ", true) << name; + if (type.is()) { + o << " (type " << type << ')'; + } if (params.size() > 0) { for (auto& param : params) { o << ' '; @@ -1001,8 +1006,8 @@ public: class Export { public: - Name name; - Name value; + Name name; // exported name + Name value; // internal name std::ostream& print(std::ostream &o, unsigned indent) { printOpening(o, "export "); |