Hi,

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
> this:
>
> 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.)

Charlie
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to