diff options
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index d5333847d..1cf867cdd 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -271,10 +271,10 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { o << "?"; break; case Type::i32: - o << literal.i32; + o << literal.geti32(); break; case Type::i64: - o << literal.i64; + o << literal.geti64(); break; case Type::f32: literal.printFloat(o, literal.getf32()); @@ -301,6 +301,21 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { return o; } +std::ostream& operator<<(std::ostream& o, wasm::Literals literals) { + if (literals.size() == 1) { + return o << literals[0]; + } else { + o << '('; + if (literals.size() > 0) { + o << literals[0]; + } + for (size_t i = 1; i < literals.size(); ++i) { + o << ", " << literals[i]; + } + return o << ')'; + } +} + Literal Literal::countLeadingZeroes() const { if (type == Type::i32) { return Literal((int32_t)CountLeadingZeroes(i32)); |