From 8c47cbf61b8751e0f82d002bea57e24f3461458f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 16 Mar 2016 14:53:36 -0700 Subject: backpatching LEB128 always fills all 5 bytes --- src/wasm-binary.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index f36dcb897..37f2d459b 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -158,9 +158,9 @@ public: (*this)[i+2] = x & 0xff; x >>= 8; (*this)[i+3] = x & 0xff; } - void writeAt(size_t i, LEB128 x, size_t minimum = 0) { - if (debug) std::cerr << "backpatchLEB128: " << x.value << " (at " << i << "), minimum " << minimum << std::endl; - x.writeAt(this, i, minimum); + void writeAt(size_t i, LEB128 x) { + if (debug) std::cerr << "backpatchLEB128: " << x.value << " (at " << i << ")" << std::endl; + x.writeAt(this, i, 5); // fill all 5 bytes, we have to do this when backpatching } template @@ -448,7 +448,7 @@ public: void finishSection(int32_t start) { int32_t size = o.size() - start - 5; // section size does not include the 5 bytes of the size field itself - o.writeAt(start, LEB128(size), 5); + o.writeAt(start, LEB128(size)); } void writeStart() { -- cgit v1.2.3