mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 18:25:58 +02:00
* memory.grow returns the previous memory size in pages, so we don't need to ask for the size first in SysOSAlloc
git-svn-id: branches/wasm@48343 -
This commit is contained in:
parent
a6d332d092
commit
8e2e31f95c
@ -24,9 +24,13 @@ function SysOSAlloc(size: ptruint): pointer;
|
||||
const
|
||||
page_size = 65536;
|
||||
err = high(longword);
|
||||
var
|
||||
res: ptruint;
|
||||
begin
|
||||
SysOSAlloc:=pointer(fpc_wasm32_memory_size*page_size);
|
||||
if fpc_wasm32_memory_grow((size + page_size - 1) div page_size) = err then
|
||||
res:=fpc_wasm32_memory_grow((size + page_size - 1) div page_size);
|
||||
if res<>err then
|
||||
SysOSAlloc:=pointer(res*page_size)
|
||||
else
|
||||
SysOSAlloc:=nil;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user