From 0a43823615155f956f078ce7b7a8a580bc01fbe1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 21 Apr 2016 21:26:32 -0700 Subject: br_table offsets are int32s, not lebs --- src/wasm-binary.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 1e54a7607..159dd24fa 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -861,9 +861,9 @@ public: recurse(curr->condition); o << int8_t(BinaryConsts::TableSwitch) << U32LEB(curr->targets.size()); for (auto target : curr->targets) { - o << U32LEB(getBreakIndex(target)); + o << uint32_t(getBreakIndex(target)); } - o << U32LEB(getBreakIndex(curr->default_)); + o << uint32_t(getBreakIndex(curr->default_)); } void visitCall(Call *curr) { if (debug) std::cerr << "zz node: Call" << std::endl; @@ -1742,9 +1742,9 @@ public: curr->value = popExpression(); auto numTargets = getU32LEB(); for (size_t i = 0; i < numTargets; i++) { - curr->targets.push_back(getBreakName(getU32LEB())); + curr->targets.push_back(getBreakName(getInt32())); } - curr->default_ = getBreakName(getU32LEB()); + curr->default_ = getBreakName(getInt32()); } void visitCall(Call *curr) { if (debug) std::cerr << "zz node: Call" << std::endl; -- cgit v1.2.3