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;


The generated assembler seems to be identical to the original code (at
least on my FreeBSD system).

.Lc1:
# Var AValue located in register edi
# Var $result located in register eax
# [project1.lpr]
# [10] asm
# [11] movl AValue, %eax
        movl    %edi,%eax
# [12] bswap %eax
        bswapl  %eax
# [13] end;
        ret
.Lc2:


Regards,
  - Graeme -

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

Reply via email to