mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 21:19:26 +02:00
* correctly align the stream on targets that require proper alignment
git-svn-id: trunk@42522 -
This commit is contained in:
parent
0b3418e978
commit
811d39d995
@ -75,6 +75,16 @@ begin
|
||||
end;
|
||||
|
||||
procedure CheckAttr1(aStrm: TStream);
|
||||
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||
{$push}
|
||||
{$packrecords c}
|
||||
type
|
||||
TAlignDummy = record
|
||||
b: Byte;
|
||||
s: Single;
|
||||
end;
|
||||
{$pop}
|
||||
{$endif}
|
||||
var
|
||||
b: Byte;
|
||||
ss: ShortString;
|
||||
@ -93,6 +103,9 @@ begin
|
||||
Halt(24);
|
||||
if ss <> StrHelloWorld then
|
||||
Halt(25);
|
||||
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||
aStrm.Position := Align(PtrUInt(aStrm.Position), PtrInt(@TAlignDummy(nil^).s)));
|
||||
{$endif}
|
||||
if aStrm.Read(s, SizeOf(Single)) <> SizeOf(Single) then
|
||||
Halt(26);
|
||||
if s <> Single(SingleVal) then
|
||||
|
Loading…
Reference in New Issue
Block a user