* fix #40421: implement assembly variants of the SwapEndian functions for Aarch64

This commit is contained in:
Sven/Sarah Barth 2023-09-08 15:03:51 +02:00
parent 98fc58b229
commit 30a1cde7a5

View File

@ -480,3 +480,46 @@ asm
end;
{$endif}
{****************************************************************************
Math Routines
****************************************************************************}
{$define FPC_SYSTEM_HAS_SWAPENDIAN}
function SwapEndian(const AValue: SmallInt): SmallInt; assembler; nostackframe;
asm
rev16 w0, w0
end;
function SwapEndian(const AValue: Word): Word; assembler; nostackframe;
asm
rev16 w0, w0
end;
function SwapEndian(const AValue: LongInt): LongInt; assembler; nostackframe;
asm
rev32 x0, x0
end;
function SwapEndian(const AValue: DWord): DWord; assembler; nostackframe;
asm
rev32 x0, x0
end;
function SwapEndian(const AValue: Int64): Int64; assembler; nostackframe;
asm
rev x0, x0
end;
function SwapEndian(const AValue: QWord): QWord; assembler; nostackframe;
asm
rev x0, x0
end;