diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-01-28 17:25:50 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-01-28 17:25:50 -0800 |
commit | 8ed5ab1e5610df34d781d346c1e50ec04d1a4036 (patch) | |
tree | 01b1c2c6f56481b47dbfddd9ac4f99e267d34efe /src/wasm-binary.h | |
parent | 991891ef329f099ab2927af173dc920bfe2f9234 (diff) | |
download | binaryen-8ed5ab1e5610df34d781d346c1e50ec04d1a4036.tar.gz binaryen-8ed5ab1e5610df34d781d346c1e50ec04d1a4036.tar.bz2 binaryen-8ed5ab1e5610df34d781d346c1e50ec04d1a4036.zip |
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
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r-- | src/wasm-binary.h | 4 |
1 files changed, 2 insertions, 2 deletions
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 } |