Skip to content

Commit

Permalink
Fix: runtime ptr length forgot to multiply by length
Browse files Browse the repository at this point in the history
  • Loading branch information
lynzrand committed Oct 25, 2024
1 parent 2fb9566 commit f4e621f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wasm_rt/runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let importObject = {
if (offset % 4 != 0) {
offset = Math.ceil(offset / 4) * 4
}
if (memory.buffer.byteLength < offset + size * 4) {
while (memory.buffer.byteLength < offset + size * 4) {
memory.grow(1)
}
let view = new Int32Array(memory.buffer, offset, size);
Expand All @@ -64,7 +64,7 @@ let importObject = {
if (offset % 8 != 0) {
offset = Math.ceil(offset / 8) * 8
}
if (memory.buffer.byteLength < offset + size * 8) {
while (memory.buffer.byteLength < offset + size * 8) {
memory.grow(1)
}
let view = new Float64Array(memory.buffer, offset, size);
Expand All @@ -77,7 +77,7 @@ let importObject = {
if (offset % 4 != 0) {
offset = Math.ceil(offset / 4) * 4
}
if (memory.buffer.byteLength < offset + size) {
while (memory.buffer.byteLength < offset + size * 4) {
memory.grow(1)
}
let view = new Uint32Array(memory.buffer, offset, size);
Expand Down

0 comments on commit f4e621f

Please sign in to comment.