On Wed, 30 Mar 2016, Graeme Geldenhuys wrote:

Hi,

Here is the x86_64's SwapEndian() function implementation.

=============[ src/rtl/x86_64/x86_64.inc ]====================
function SwapEndian(const AValue: DWord): DWord; assembler; nostackframe;
asm
{$ifdef win64}
 movl %ecx, %eax
{$else win64}
 movl %edi, %eax
{$endif win64}
 bswap %eax
end;
=============================================

Surely the usage of IFDEF WIN64 is not 100% correct or accurate. Should
the above not rather read IFDEF CPU64?

No, the code is exclusively for all 64-bit platforms.

The code is there to differentiate between the windows ABI and other ABIS,
which specify in what register the AValue parameter is passed.

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

Reply via email to