浏览代码

* 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;
 
 {$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;
+