[fpc-pascal] IFDEF usage in x86_64's SwapEndian() implementation
Michael Van Canneyt
michael at freepascal.org
Wed Mar 30 12:58:40 CEST 2016
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.
More information about the fpc-pascal
mailing list