|
@@ -45,10 +45,14 @@ type
|
|
|
|
|
|
class function Asr64(Value: int64; ShiftBits: Int32): int64; static; inline;
|
|
class function Asr64(Value: int64; ShiftBits: Int32): int64; static; inline;
|
|
|
|
|
|
|
|
+ class function RotateLeft8(a_value: Byte; a_n: Int32): Byte; overload;
|
|
|
|
+ static; inline;
|
|
class function RotateLeft32(a_value: UInt32; a_n: Int32): UInt32; overload;
|
|
class function RotateLeft32(a_value: UInt32; a_n: Int32): UInt32; overload;
|
|
static; inline;
|
|
static; inline;
|
|
class function RotateLeft64(a_value: UInt64; a_n: Int32): UInt64; overload;
|
|
class function RotateLeft64(a_value: UInt64; a_n: Int32): UInt64; overload;
|
|
static; inline;
|
|
static; inline;
|
|
|
|
+ class function RotateRight8(a_value: Byte; a_n: Int32): Byte; overload;
|
|
|
|
+ static; inline;
|
|
class function RotateRight32(a_value: UInt32; a_n: Int32): UInt32; overload;
|
|
class function RotateRight32(a_value: UInt32; a_n: Int32): UInt32; overload;
|
|
static; inline;
|
|
static; inline;
|
|
class function RotateRight64(a_value: UInt64; a_n: Int32): UInt64; overload;
|
|
class function RotateRight64(a_value: UInt64; a_n: Int32): UInt64; overload;
|
|
@@ -174,6 +178,20 @@ begin
|
|
{$ENDIF FPC}
|
|
{$ENDIF FPC}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+class function TBits.RotateLeft8(a_value: Byte; a_n: Int32): Byte;
|
|
|
|
+begin
|
|
|
|
+{$IFDEF DEBUG}
|
|
|
|
+ System.Assert(a_n >= 0);
|
|
|
|
+{$ENDIF DEBUG}
|
|
|
|
+{$IFDEF FPC}
|
|
|
|
+ Result := RolByte(a_value, a_n);
|
|
|
|
+{$ELSE}
|
|
|
|
+ a_n := a_n and 7;
|
|
|
|
+
|
|
|
|
+ Result := (a_value shl a_n) or (a_value shr (8 - a_n));
|
|
|
|
+{$ENDIF FPC}
|
|
|
|
+end;
|
|
|
|
+
|
|
class function TBits.RotateLeft32(a_value: UInt32; a_n: Int32): UInt32;
|
|
class function TBits.RotateLeft32(a_value: UInt32; a_n: Int32): UInt32;
|
|
begin
|
|
begin
|
|
{$IFDEF DEBUG}
|
|
{$IFDEF DEBUG}
|
|
@@ -202,6 +220,20 @@ begin
|
|
{$ENDIF FPC}
|
|
{$ENDIF FPC}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+class function TBits.RotateRight8(a_value: Byte; a_n: Int32): Byte;
|
|
|
|
+begin
|
|
|
|
+{$IFDEF DEBUG}
|
|
|
|
+ System.Assert(a_n >= 0);
|
|
|
|
+{$ENDIF DEBUG}
|
|
|
|
+{$IFDEF FPC}
|
|
|
|
+ Result := RorByte(a_value, a_n);
|
|
|
|
+{$ELSE}
|
|
|
|
+ a_n := a_n and 7;
|
|
|
|
+
|
|
|
|
+ Result := (a_value shr a_n) or (a_value shl (8 - a_n));
|
|
|
|
+{$ENDIF FPC}
|
|
|
|
+end;
|
|
|
|
+
|
|
class function TBits.RotateRight32(a_value: UInt32; a_n: Int32): UInt32;
|
|
class function TBits.RotateRight32(a_value: UInt32; a_n: Int32): UInt32;
|
|
begin
|
|
begin
|
|
{$IFDEF DEBUG}
|
|
{$IFDEF DEBUG}
|