From 8ed5ab1e5610df34d781d346c1e50ec04d1a4036 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 28 Jan 2016 17:25:50 -0800 Subject: current binary format has power of 2 memory, so use ceil to ensure that the conversion only increases memory, and does not make it too small for the segments --- src/wasm-binary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index d2959c69d..aea31233d 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -390,8 +390,8 @@ public: void writeMemory() { if (wasm->memory.max == 0) return; if (debug) std::cerr << "== writeMemory" << std::endl; - o << int8_t(BinaryConsts::Memory) << int8_t(log2(wasm->memory.initial)) - << int8_t(log2(wasm->memory.max)) + o << int8_t(BinaryConsts::Memory) << int8_t(ceil(log2(wasm->memory.initial))) + << int8_t(ceil(log2(wasm->memory.max))) << int8_t(1); // export memory } -- cgit v1.2.3