summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-16 14:53:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-03-16 14:53:50 -0700
commit8c47cbf61b8751e0f82d002bea57e24f3461458f (patch)
tree9d4a9c8332ffb7e626fd7e2d1f577d38dc831e90 /src
parent227f4e473b39d28f749f4252a0a922517d3a4938 (diff)
downloadbinaryen-8c47cbf61b8751e0f82d002bea57e24f3461458f.tar.gz
binaryen-8c47cbf61b8751e0f82d002bea57e24f3461458f.tar.bz2
binaryen-8c47cbf61b8751e0f82d002bea57e24f3461458f.zip
backpatching LEB128 always fills all 5 bytes
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h8
1 files changed, 4 insertions, 4 deletions
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 <typename T>
@@ -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() {