瀏覽代碼

* rewrote Ror/Rol/Sar so that it can be completely folded into a const by the compiler
if possible, the copied (dist and xxx) expressions are folded by the CSE so they don't hurt

git-svn-id: trunk@17764 -

florian 14 年之前
父節點
當前提交
efea42bcdf
共有 2 個文件被更改,包括 44 次插入56 次删除
  1. 24 36
      rtl/inc/generic.inc
  2. 20 20
      rtl/inc/systemh.inc

+ 24 - 36
rtl/inc/generic.inc

@@ -2274,10 +2274,9 @@ function RorByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
   end;
   end;
 
 
 
 
-function RorByte(Const AValue : Byte;Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorByte(Const AValue : Byte;const Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 7;
-    Result:=(AValue shr Dist) or (AValue shl (8-Dist));
+    Result:=(AValue shr (Dist and 7)) or (AValue shl (8-(Dist and 7)));
   end;
   end;
 
 
 
 
@@ -2287,10 +2286,9 @@ function RolByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
   end;
   end;
 
 
 
 
-function RolByte(Const AValue : Byte;Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolByte(Const AValue : Byte;const Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 7;
-    Result:=(AValue shl Dist) or (AValue shr (8-Dist));
+    Result:=(AValue shl (Dist and 7)) or (AValue shr (8-(Dist and 7)));
   end;
   end;
 
 
 {$endif FPC_SYSTEM_HAS_ROX_BYTE}
 {$endif FPC_SYSTEM_HAS_ROX_BYTE}
@@ -2305,10 +2303,9 @@ function RorWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
   end;
   end;
 
 
 
 
-function RorWord(Const AValue : Word;Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorWord(Const AValue : Word;const Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 15;
-    Result:=(AValue shr Dist) or (AValue shl (16-Dist));
+    Result:=(AValue shr (Dist and 15)) or (AValue shl (16-(Dist and 15)));
   end;
   end;
 
 
 
 
@@ -2318,10 +2315,9 @@ function RolWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
   end;
   end;
 
 
 
 
-function RolWord(Const AValue : Word;Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolWord(Const AValue : Word;const Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 15;
-    Result:=(AValue shl Dist) or (AValue shr (16-Dist));
+    Result:=(AValue shl (Dist and 15)) or (AValue shr (16-(Dist and 15)));
   end;
   end;
 
 
 {$endif FPC_SYSTEM_HAS_ROX_WORD}
 {$endif FPC_SYSTEM_HAS_ROX_WORD}
@@ -2336,10 +2332,9 @@ function RorDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$end
   end;
   end;
 
 
 
 
-function RorDWord(Const AValue : DWord;Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorDWord(Const AValue : DWord;const Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 31;
-    Result:=(AValue shr Dist) or (AValue shl (32-Dist));
+    Result:=(AValue shr (Dist and 31)) or (AValue shl (32-(Dist and 31)));
   end;
   end;
 
 
 
 
@@ -2349,10 +2344,9 @@ function RolDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$end
   end;
   end;
 
 
 
 
-function RolDWord(Const AValue : DWord;Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolDWord(Const AValue : DWord;const Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 31;
-    Result:=(AValue shl Dist) or (AValue shr (32-Dist));
+    Result:=(AValue shl (Dist and 31)) or (AValue shr (32-(Dist and 31)));
   end;
   end;
 
 
 {$endif FPC_SYSTEM_HAS_ROX_DWORD}
 {$endif FPC_SYSTEM_HAS_ROX_DWORD}
@@ -2367,10 +2361,9 @@ function RorQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$end
   end;
   end;
 
 
 
 
-function RorQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorQWord(Const AValue : QWord;const Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 63;
-    Result:=(AValue shr Dist) or (AValue shl (64-Dist));
+    Result:=(AValue shr (Dist and 63)) or (AValue shl (64-(Dist and 63)));
   end;
   end;
 
 
 
 
@@ -2380,10 +2373,9 @@ function RolQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$end
   end;
   end;
 
 
 
 
-function RolQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolQWord(Const AValue : QWord;const Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
-    Dist:=Dist and 63;
-    Result:=(AValue shl Dist) or (AValue shr (64-Dist));
+    Result:=(AValue shl (Dist and 63)) or (AValue shr (64-(Dist and 63)));
   end;
   end;
 
 
 {$endif FPC_SYSTEM_HAS_ROX_QWORD}
 {$endif FPC_SYSTEM_HAS_ROX_QWORD}
@@ -2391,40 +2383,36 @@ function RolQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}
 
 
 {$ifndef FPC_HAS_INTERNAL_SAR_BYTE}
 {$ifndef FPC_HAS_INTERNAL_SAR_BYTE}
 {$ifndef FPC_SYSTEM_HAS_SAR_BYTE}
 {$ifndef FPC_SYSTEM_HAS_SAR_BYTE}
-function SarShortint(Const AValue : Shortint;Shift : Byte): Shortint;
+function SarShortint(Const AValue : Shortint;const Shift : Byte): Shortint;
   begin
   begin
-    Shift:=Shift and 7;
-    Result:=shortint(byte(byte(byte(AValue) shr Shift) or (byte(shortint(byte(0-byte(byte(AValue) shr 7)) and byte(shortint(0-(ord(Shift<>0){ and 1}))))) shl (8-Shift))));
+    Result:=shortint(byte(byte(byte(AValue) shr (Shift and 7)) or (byte(shortint(byte(0-byte(byte(AValue) shr 7)) and byte(shortint(0-(ord((Shift and 7)<>0){ and 1}))))) shl (8-(Shift and 7)))));
   end;
   end;
 {$endif FPC_HAS_INTERNAL_SAR_BYTE}
 {$endif FPC_HAS_INTERNAL_SAR_BYTE}
 {$endif FPC_SYSTEM_HAS_SAR_BYTE}
 {$endif FPC_SYSTEM_HAS_SAR_BYTE}
 
 
 {$ifndef FPC_HAS_INTERNAL_SAR_WORD}
 {$ifndef FPC_HAS_INTERNAL_SAR_WORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_WORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_WORD}
-function SarSmallint(Const AValue : Smallint;Shift : Byte): Smallint;
+function SarSmallint(Const AValue : Smallint;const Shift : Byte): Smallint;
   begin
   begin
-    Shift:=Shift and 15;
-    Result:=smallint(word(word(word(AValue) shr Shift) or (word(smallint(word(0-word(word(AValue) shr 15)) and word(smallint(0-(ord(Shift<>0){ and 1}))))) shl (16-Shift))));
+    Result:=smallint(word(word(word(AValue) shr (Shift and 15)) or (word(smallint(word(0-word(word(AValue) shr 15)) and word(smallint(0-(ord((Shift and 15)<>0){ and 1}))))) shl (16-(Shift and 15)))));
   end;
   end;
 {$endif FPC_HAS_INTERNAL_SAR_WORD}
 {$endif FPC_HAS_INTERNAL_SAR_WORD}
 {$endif FPC_SYSTEM_HAS_SAR_WORD}
 {$endif FPC_SYSTEM_HAS_SAR_WORD}
 
 
 {$ifndef FPC_HAS_INTERNAL_SAR_DWORD}
 {$ifndef FPC_HAS_INTERNAL_SAR_DWORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_DWORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_DWORD}
-function SarLongint(Const AValue : Longint;Shift : Byte): Longint;
+function SarLongint(Const AValue : Longint;const Shift : Byte): Longint;
   begin
   begin
-    Shift:=Shift and 31;
-    Result:=longint(dword(dword(dword(AValue) shr Shift) or (dword(longint(dword(0-dword(dword(AValue) shr 31)) and dword(longint(0-(ord(Shift<>0){ and 1}))))) shl (32-Shift))));
+    Result:=longint(dword(dword(dword(AValue) shr (Shift and 31)) or (dword(longint(dword(0-dword(dword(AValue) shr 31)) and dword(longint(0-(ord((Shift and 31)<>0){ and 1}))))) shl (32-(Shift and 31)))));
   end;
   end;
 {$endif FPC_HAS_INTERNAL_SAR_DWORD}
 {$endif FPC_HAS_INTERNAL_SAR_DWORD}
 {$endif FPC_SYSTEM_HAS_SAR_DWORD}
 {$endif FPC_SYSTEM_HAS_SAR_DWORD}
 
 
 {$ifndef FPC_HAS_INTERNAL_SAR_QWORD}
 {$ifndef FPC_HAS_INTERNAL_SAR_QWORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_QWORD}
 {$ifndef FPC_SYSTEM_HAS_SAR_QWORD}
-function SarInt64(Const AValue : Int64;Shift : Byte): Int64;
+function SarInt64(Const AValue : Int64;const Shift : Byte): Int64;
   begin
   begin
-    Shift:=Shift and 63;
-    Result:=int64(qword(qword(qword(AValue) shr Shift) or (qword(int64(qword(0-qword(qword(AValue) shr 63)) and qword(int64(0-(ord(Shift<>0){ and 1}))))) shl (64-Shift))));
+    Result:=int64(qword(qword(qword(AValue) shr (Shift and 63)) or (qword(int64(qword(0-qword(qword(AValue) shr 63)) and qword(int64(0-(ord((Shift and 63)<>0){ and 1}))))) shl (64-(Shift and 63)))));
   end;
   end;
 {$endif FPC_HAS_INTERNAL_SAR_QWORD}
 {$endif FPC_HAS_INTERNAL_SAR_QWORD}
 {$endif FPC_SYSTEM_HAS_SAR_QWORD}
 {$endif FPC_SYSTEM_HAS_SAR_QWORD}

+ 20 - 20
rtl/inc/systemh.inc

@@ -645,61 +645,61 @@ function NtoLE(const AValue: QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 {$ifdef FPC_HAS_INTERNAL_ROX_BYTE}
 {$ifdef FPC_HAS_INTERNAL_ROX_BYTE}
 function RorByte(Const AValue : Byte): Byte;[internproc:fpc_in_ror_x];
 function RorByte(Const AValue : Byte): Byte;[internproc:fpc_in_ror_x];
-function RorByte(Const AValue : Byte;Dist : Byte): Byte;[internproc:fpc_in_ror_x_x];
+function RorByte(Const AValue : Byte;const Dist : Byte): Byte;[internproc:fpc_in_ror_x_x];
 
 
 function RolByte(Const AValue : Byte): Byte;[internproc:fpc_in_rol_x];
 function RolByte(Const AValue : Byte): Byte;[internproc:fpc_in_rol_x];
-function RolByte(Const AValue : Byte;Dist : Byte): Byte;[internproc:fpc_in_rol_x_x];
+function RolByte(Const AValue : Byte;const Dist : Byte): Byte;[internproc:fpc_in_rol_x_x];
 {$else FPC_HAS_INTERNAL_ROX_BYTE}
 {$else FPC_HAS_INTERNAL_ROX_BYTE}
 function RorByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RorByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RorByte(Const AValue : Byte;Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorByte(Const AValue : Byte;const Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 function RolByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RolByte(Const AValue : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RolByte(Const AValue : Byte;Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolByte(Const AValue : Byte;const Dist : Byte): Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$endif FPC_HAS_INTERNAL_ROX_BYTE}
 {$endif FPC_HAS_INTERNAL_ROX_BYTE}
 
 
 
 
 {$ifdef FPC_HAS_INTERNAL_ROX_WORD}
 {$ifdef FPC_HAS_INTERNAL_ROX_WORD}
 function RorWord(Const AValue : Word): Word;[internproc:fpc_in_ror_x];
 function RorWord(Const AValue : Word): Word;[internproc:fpc_in_ror_x];
-function RorWord(Const AValue : Word;Dist : Byte): Word;[internproc:fpc_in_ror_x_x];
+function RorWord(Const AValue : Word;const Dist : Byte): Word;[internproc:fpc_in_ror_x_x];
 
 
 function RolWord(Const AValue : Word): Word;[internproc:fpc_in_rol_x];
 function RolWord(Const AValue : Word): Word;[internproc:fpc_in_rol_x];
-function RolWord(Const AValue : Word;Dist : Byte): Word;[internproc:fpc_in_rol_x_x];
+function RolWord(Const AValue : Word;const Dist : Byte): Word;[internproc:fpc_in_rol_x_x];
 {$else FPC_HAS_INTERNAL_ROX_WORD}
 {$else FPC_HAS_INTERNAL_ROX_WORD}
 function RorWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RorWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RorWord(Const AValue : Word;Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorWord(Const AValue : Word;const Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 function RolWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RolWord(Const AValue : Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RolWord(Const AValue : Word;Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolWord(Const AValue : Word;const Dist : Byte): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$endif FPC_HAS_INTERNAL_ROX_WORD}
 {$endif FPC_HAS_INTERNAL_ROX_WORD}
 
 
 
 
 {$ifdef FPC_HAS_INTERNAL_ROX_DWORD}
 {$ifdef FPC_HAS_INTERNAL_ROX_DWORD}
 function RorDWord(Const AValue : DWord): DWord;[internproc:fpc_in_ror_x];
 function RorDWord(Const AValue : DWord): DWord;[internproc:fpc_in_ror_x];
-function RorDWord(Const AValue : DWord;Dist : Byte): DWord;[internproc:fpc_in_ror_x_x];
+function RorDWord(Const AValue : DWord;const Dist : Byte): DWord;[internproc:fpc_in_ror_x_x];
 
 
 function RolDWord(Const AValue : DWord): DWord;[internproc:fpc_in_rol_x];
 function RolDWord(Const AValue : DWord): DWord;[internproc:fpc_in_rol_x];
-function RolDWord(Const AValue : DWord;Dist : Byte): DWord;[internproc:fpc_in_rol_x_x];
+function RolDWord(Const AValue : DWord;const Dist : Byte): DWord;[internproc:fpc_in_rol_x_x];
 {$else FPC_HAS_INTERNAL_ROX_DWORD}
 {$else FPC_HAS_INTERNAL_ROX_DWORD}
 function RorDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RorDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RorDWord(Const AValue : DWord;Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorDWord(Const AValue : DWord;const Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 function RolDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RolDWord(Const AValue : DWord): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RolDWord(Const AValue : DWord;Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolDWord(Const AValue : DWord;const Dist : Byte): DWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$endif FPC_HAS_INTERNAL_ROX_DWORD}
 {$endif FPC_HAS_INTERNAL_ROX_DWORD}
 
 
 
 
 {$ifdef FPC_HAS_INTERNAL_ROX_QWORD}
 {$ifdef FPC_HAS_INTERNAL_ROX_QWORD}
 function RorQWord(Const AValue : QWord): QWord;[internproc:fpc_in_ror_x];
 function RorQWord(Const AValue : QWord): QWord;[internproc:fpc_in_ror_x];
-function RorQWord(Const AValue : QWord;Dist : Byte): QWord;[internproc:fpc_in_ror_x_x];
+function RorQWord(Const AValue : QWord;const Dist : Byte): QWord;[internproc:fpc_in_ror_x_x];
 
 
 function RolQWord(Const AValue : QWord): QWord;[internproc:fpc_in_rol_x];
 function RolQWord(Const AValue : QWord): QWord;[internproc:fpc_in_rol_x];
-function RolQWord(Const AValue : QWord;Dist : Byte): QWord;[internproc:fpc_in_rol_x_x];
+function RolQWord(Const AValue : QWord;const Dist : Byte): QWord;[internproc:fpc_in_rol_x_x];
 {$else FPC_HAS_INTERNAL_ROX_QWORD}
 {$else FPC_HAS_INTERNAL_ROX_QWORD}
 function RorQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RorQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RorQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RorQWord(Const AValue : QWord;const Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 function RolQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 function RolQWord(Const AValue : QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-function RolQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
+function RolQWord(Const AValue : QWord;const Dist : Byte): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$endif FPC_HAS_INTERNAL_ROX_QWORD}
 {$endif FPC_HAS_INTERNAL_ROX_QWORD}
 
 
 {$ifdef FPC_HAS_INTERNAL_SAR}
 {$ifdef FPC_HAS_INTERNAL_SAR}
@@ -724,28 +724,28 @@ function RolQWord(Const AValue : QWord;Dist : Byte): QWord;{$ifdef SYSTEMINLINE}
 function SarShortint(Const AValue : Shortint): Shortint;[internproc:fpc_in_sar_x];
 function SarShortint(Const AValue : Shortint): Shortint;[internproc:fpc_in_sar_x];
 function SarShortint(Const AValue : Shortint;Shift : Byte): Shortint;[internproc:fpc_in_sar_x_y];
 function SarShortint(Const AValue : Shortint;Shift : Byte): Shortint;[internproc:fpc_in_sar_x_y];
 {$else FPC_HAS_INTERNAL_ROX_BYTE}
 {$else FPC_HAS_INTERNAL_ROX_BYTE}
-function SarShortint(Const AValue : Shortint;Shift : Byte = 1): Shortint;
+function SarShortint(Const AValue : Shortint;const Shift : Byte = 1): Shortint;
 {$endif FPC_HAS_INTERNAL_ROX_BYTE}
 {$endif FPC_HAS_INTERNAL_ROX_BYTE}
 
 
 {$ifdef FPC_HAS_INTERNAL_SAR_WORD}
 {$ifdef FPC_HAS_INTERNAL_SAR_WORD}
 function SarSmallint(Const AValue : Smallint): Smallint;[internproc:fpc_in_sar_x];
 function SarSmallint(Const AValue : Smallint): Smallint;[internproc:fpc_in_sar_x];
 function SarSmallint(Const AValue : Smallint;Shift : Byte): Smallint;[internproc:fpc_in_sar_x_y];
 function SarSmallint(Const AValue : Smallint;Shift : Byte): Smallint;[internproc:fpc_in_sar_x_y];
 {$else FPC_HAS_INTERNAL_SAR_WORD}
 {$else FPC_HAS_INTERNAL_SAR_WORD}
-function SarSmallint(Const AValue : Smallint;Shift : Byte = 1): Smallint;
+function SarSmallint(Const AValue : Smallint;const Shift : Byte = 1): Smallint;
 {$endif FPC_HAS_INTERNAL_SAR_WORD}
 {$endif FPC_HAS_INTERNAL_SAR_WORD}
 
 
 {$ifdef FPC_HAS_INTERNAL_SAR_DWORD}
 {$ifdef FPC_HAS_INTERNAL_SAR_DWORD}
 function SarLongint(Const AValue : Longint): Longint;[internproc:fpc_in_sar_x];
 function SarLongint(Const AValue : Longint): Longint;[internproc:fpc_in_sar_x];
 function SarLongint(Const AValue : Longint;Shift : Byte): Longint;[internproc:fpc_in_sar_x_y];
 function SarLongint(Const AValue : Longint;Shift : Byte): Longint;[internproc:fpc_in_sar_x_y];
 {$else FPC_HAS_INTERNAL_SAR_DWORD}
 {$else FPC_HAS_INTERNAL_SAR_DWORD}
-function SarLongint(Const AValue : Longint;Shift : Byte = 1): Longint;
+function SarLongint(Const AValue : Longint;const Shift : Byte = 1): Longint;
 {$endif FPC_HAS_INTERNAL_SAR_DWORD}
 {$endif FPC_HAS_INTERNAL_SAR_DWORD}
 
 
 {$ifdef FPC_HAS_INTERNAL_SAR_QWORD}
 {$ifdef FPC_HAS_INTERNAL_SAR_QWORD}
 function SarInt64(Const AValue : Int64): Int64;[internproc:fpc_in_sar_x];
 function SarInt64(Const AValue : Int64): Int64;[internproc:fpc_in_sar_x];
 function SarInt64(Const AValue : Int64;Shift : Byte): Int64;[internproc:fpc_in_sar_x_y];
 function SarInt64(Const AValue : Int64;Shift : Byte): Int64;[internproc:fpc_in_sar_x_y];
 {$else FPC_HAS_INTERNAL_SAR_QWORD}
 {$else FPC_HAS_INTERNAL_SAR_QWORD}
-function SarInt64(Const AValue : Int64;Shift : Byte = 1): Int64;
+function SarInt64(Const AValue : Int64;const Shift : Byte = 1): Int64;
 {$endif FPC_HAS_INTERNAL_SAR_QWORD}
 {$endif FPC_HAS_INTERNAL_SAR_QWORD}
 
 
 {$ifdef FPC_HAS_INTERNAL_BSX}
 {$ifdef FPC_HAS_INTERNAL_BSX}