Преглед изворни кода

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

Sven/Sarah Barth пре 1 година
родитељ
комит
30a1cde7a5
1 измењених фајлова са 43 додато и 0 уклоњено
  1. 43 0
      rtl/aarch64/aarch64.inc

+ 43 - 0
rtl/aarch64/aarch64.inc

@@ -480,3 +480,46 @@ asm
 end;
 end;
 
 
 {$endif}
 {$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;
+