Refactor limits emit and memory growing

This commit is contained in:
Rerumu
2021-11-26 20:13:41 -05:00
parent 2746c1e3d1
commit c0a5d0c7dd
3 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -327,7 +327,7 @@ do
memory.min = min
memory.max = max
memory.data = ffi.new(vla_u8, min * WASM_PAGE_SIZE)
memory.data = vla_u8(min * WASM_PAGE_SIZE, 0)
return memory
end
@@ -340,7 +340,7 @@ do
local old = memory.min
local new = old + num
if memory.max and new > memory.max then
if new > memory.max then
return -1
else
grow_unchecked(memory, old, new)
+1 -1
View File
@@ -273,7 +273,7 @@ do
local old = memory.min
local new = old + num
if memory.max and new > memory.max then
if new > memory.max then
return -1
else
memory.min = new