[fpc-pascal] IFDEF usage in x86_64's SwapEndian() implementation

Michael Van Canneyt michael at freepascal.org
Wed Mar 30 13:19:15 CEST 2016

On Wed, 30 Mar 2016, Graeme Geldenhuys wrote:

> On 2016-03-30 11:58, Michael Van Canneyt wrote:
>> The code is there to differentiate between the windows ABI and other ABIS,
>> which specify in what register the AValue parameter is passed.
> Ah okay. One could possibly write it in a less ambiguous way, as
> follows? No IFDEF's needed.
> function SwapEndian(const AValue: DWord): DWord; assembler; nostackframe;
> asm
>  movl AValue, %eax
>  bswap %eax
> end;

I am not proficient enough in the assembler parts of the compiler to comment
on this. Maybe one of the compiler people knows why it is the way it is...


More information about the fpc-pascal mailing list