* changed the asizeint and asizeuint to 32-bit on CPUs with 16-bit address

space, in order to allow data structures larger than 32k (and less than 64k)

git-svn-id: trunk@32529 -
This commit is contained in:
nickysn 2015-11-25 15:35:38 +00:00
parent f65cb5d933
commit bfa96171e0
2 changed files with 15 additions and 0 deletions

View File

@ -92,8 +92,16 @@ interface
PAInt = ^AInt;
{ target cpu specific type used to store data sizes }
{$ifdef cpu16bitaddr}
{ on small CPUs such as i8086, we use LongInt to support data structures
larger than 32767 bytes and up to 65535 bytes in size. Since asizeint
must be signed, we use LongInt/LongWord. }
ASizeInt = LongInt;
ASizeUInt = LongWord;
{$else cpu16bitaddr}
ASizeInt = PInt;
ASizeUInt = PUInt;
{$endif cpu16bitaddr}
{ type used for handling constants etc. in the code generator }
TCGInt = Int64;

View File

@ -3781,6 +3781,13 @@ implementation
if (ado_IsBitPacked in arrayoptions) then
{ can't just add 7 and divide by 8, because that may overflow }
result:=result div 8 + ord((result mod 8)<>0);
{$ifdef cpu16bitaddr}
if result>65535 then
begin
result:=-1;
exit;
end;
{$endif cpu16bitaddr}
end;