mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-28 10:39:23 +02:00
+ introduced constant MaxIntResource, use it in InternalIsIntResource
This commit is contained in:
parent
3fac1e7d5b
commit
e51fb8020c
@ -12,6 +12,21 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
const
|
||||
{$if defined(CPUWASM)}
|
||||
{ Since WebAssembly is a Harvard architecture, the code is invisible in linear
|
||||
memory and the data section starts at address 0. Resources reside after the
|
||||
initialized data section, just before the bss (uninitialized data) section,
|
||||
therefore it's perfectly possible that their data exist on a relatively low
|
||||
address (less than 64KB). So, for WebAssembly we check whether the pointer
|
||||
resides in the first 4KB of linear memory, instead of the first 64KB. Note
|
||||
that the first 4KB of linear memory in WebAssembly aren't used by Free
|
||||
Pascal. }
|
||||
MaxIntResource=4095;
|
||||
{$else}
|
||||
MaxIntResource=65535;
|
||||
{$endif}
|
||||
|
||||
type
|
||||
PResInfoNode = ^TResInfoNode;
|
||||
TResInfoNode = packed record
|
||||
@ -100,19 +115,7 @@ var i : integer;
|
||||
s : shortstring;
|
||||
code : word;
|
||||
begin
|
||||
{$if defined(CPUWASM)}
|
||||
{ Since WebAssembly is a Harvard architecture, the code is invisible in linear
|
||||
memory and the data section starts at address 0. Resources reside after the
|
||||
initialized data section, just before the bss (uninitialized data) section,
|
||||
therefore it's perfectly possible that their data exist on a relatively low
|
||||
address (less than 64KB). So, for WebAssembly we check whether the pointer
|
||||
resides in the first 4KB of linear memory, instead of the first 64KB. Note
|
||||
that the first 4KB of linear memory in WebAssembly aren't used by Free
|
||||
Pascal. }
|
||||
InternalIsIntResource:=((PtrUInt(aStr) shr 12)=0);
|
||||
{$else}
|
||||
InternalIsIntResource:=((PtrUInt(aStr) shr 16)=0);
|
||||
{$endif}
|
||||
InternalIsIntResource:=PtrUInt(aStr)<=MaxIntResource;
|
||||
if InternalIsIntResource then aInt:=PtrUInt(aStr)
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user