Browse Source

Add several copy64 methods

Ugochukwu Mmaduekwe 6 years ago
parent
commit
db434d8abf
1 changed files with 28 additions and 0 deletions
  1. 28 0
      CryptoLib/src/Math/Raw/ClpNat.pas

+ 28 - 0
CryptoLib/src/Math/Raw/ClpNat.pas

@@ -118,6 +118,16 @@ type
       xOff: Int32; const z: TCryptoLibUInt32Array; zOff: Int32); overload;
       xOff: Int32; const z: TCryptoLibUInt32Array; zOff: Int32); overload;
       static; inline;
       static; inline;
 
 
+    class procedure Copy64(len: Int32; const x, z: TCryptoLibUInt64Array);
+      overload; static; inline;
+
+    class function Copy64(len: Int32; const x: TCryptoLibUInt64Array)
+      : TCryptoLibUInt64Array; overload; static; inline;
+
+    class procedure Copy64(len: Int32; const x: TCryptoLibUInt64Array;
+      xOff: Int32; const z: TCryptoLibUInt64Array; zOff: Int32); overload;
+      static; inline;
+
     class function Create(len: Int32): TCryptoLibUInt32Array; static; inline;
     class function Create(len: Int32): TCryptoLibUInt32Array; static; inline;
 
 
     class function Create64(len: Int32): TCryptoLibUInt64Array; static; inline;
     class function Create64(len: Int32): TCryptoLibUInt64Array; static; inline;
@@ -987,6 +997,24 @@ begin
   System.Move(x[0], z[0], len * System.SizeOf(UInt32));
   System.Move(x[0], z[0], len * System.SizeOf(UInt32));
 end;
 end;
 
 
+class procedure TNat.Copy64(len: Int32; const x: TCryptoLibUInt64Array;
+  xOff: Int32; const z: TCryptoLibUInt64Array; zOff: Int32);
+begin
+  System.Move(x[xOff], z[zOff], len * System.SizeOf(UInt64));
+end;
+
+class function TNat.Copy64(len: Int32; const x: TCryptoLibUInt64Array)
+  : TCryptoLibUInt64Array;
+begin
+  System.SetLength(Result, len);
+  System.Move(x[0], Result[0], len * System.SizeOf(UInt64));
+end;
+
+class procedure TNat.Copy64(len: Int32; const x, z: TCryptoLibUInt64Array);
+begin
+  System.Move(x[0], z[0], len * System.SizeOf(UInt64));
+end;
+
 class procedure TNat.Copy(len: Int32; const x: TCryptoLibUInt32Array;
 class procedure TNat.Copy(len: Int32; const x: TCryptoLibUInt32Array;
   xOff: Int32; const z: TCryptoLibUInt32Array; zOff: Int32);
   xOff: Int32; const z: TCryptoLibUInt32Array; zOff: Int32);
 begin
 begin