[fpc-devel] Packed record integers and x86_86
J. Gareth Moreton
gareth at moreton-family.com
Thu Mar 28 14:59:39 CET 2019
Heh, much better - thank you!
On Thu 28/03/19 14:31 , "Karoly Balogh (Charlie/SGR)"
charlie at scenergy.dfmk.hu sent:
On Thu, 28 Mar 2019, J. Gareth Moreton wrote:
> I think the official unsigned 32-bit integer type in Pascal is
> "LongWord". As others have said, be aware that pointers are 64-bit under
> x64... that's kind of why it's called x64! If you absolutely must have
> a packed record with 32-bit types, I recommend changing Sender and
> Target to indices that are added to a base address.
> Similar to what Pierre said, change your Pointer code to something like
> for Indx := 0 to SizeOf(TTCPPackageHeader) - 1 do
Dec(Byte(Pointer(PtrUInt(@x) + Indx)^), ARollCount);
How about Dec(PByte(@x)[Indx], ARollCount); instead? That doesn't look
like an angry C programmer tried to convert some abomination to Pascal,
and works on all pointer sizes.
(Unless it also has to compile with say, Delphi.)
fpc-devel maillist - fpc-devel at lists.freepascal.org 
 mailto:fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel