From 227f4e473b39d28f749f4252a0a922517d3a4938 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 16 Mar 2016 14:44:04 -0700 Subject: refactor an LEB128 placeholder method --- src/wasm-binary.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 4b7e1a2a4..f36dcb897 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -432,11 +432,16 @@ public: o << int32_t(10); // version number } - int32_t startSection(const char* name) { - // emit 5 bytes of 0, which we'll fill with LEB later + int32_t writeLEB128Placeholder() { int32_t ret = o.size(); o << int32_t(0); o << int8_t(0); + return ret; + } + + int32_t startSection(const char* name) { + // emit 5 bytes of 0, which we'll fill with LEB later + auto ret = writeLEB128Placeholder(); writeInlineString(name); return ret; } -- cgit v1.2.3