Skip to content

Commit 6770ee4

Browse files
committed
Round the number of pages passed to Memory.grow. NFC
Without this the trace line below prints (somewhat confusingly): ``` growMemory: 80740352 (+1048576 bytes / 16.999984741210938 pages) ```
1 parent 02577a5 commit 6770ee4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ addToLibrary({
190190
// it. Returns 1 on success, 0 on error.
191191
$growMemory: (size) => {
192192
var b = wasmMemory.buffer;
193-
var pages = (size - b.byteLength + {{{ WASM_PAGE_SIZE - 1 }}}) / {{{ WASM_PAGE_SIZE }}};
193+
var pages = ((size - b.byteLength + {{{ WASM_PAGE_SIZE - 1 }}}) / {{{ WASM_PAGE_SIZE }}}) | 0;
194194
#if RUNTIME_DEBUG
195195
dbg(`growMemory: ${size} (+${size - b.byteLength} bytes / ${pages} pages)`);
196196
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2570
1+
2571
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5344
1+
5346

0 commit comments

Comments
 (0)