Jelajahi Sumber

Merge downstream

Herman Schoenfeld 7 tahun lalu
induk
melakukan
711db23e2c

+ 8 - 8
src/libraries/hashlib4pascal/HlpConverters.pas

@@ -72,16 +72,16 @@ type
     class function ReadUInt64AsBytesLE(a_in: UInt64): THashLibByteArray;
       overload; static; inline;
 
-    class procedure ReadUInt32AsBytesLE(a_in: UInt32; a_out: THashLibByteArray;
+    class procedure ReadUInt32AsBytesLE(a_in: UInt32; const a_out: THashLibByteArray;
       a_index: Int32); overload; static; inline;
 
-    class procedure ReadUInt32AsBytesBE(a_in: UInt32; a_out: THashLibByteArray;
+    class procedure ReadUInt32AsBytesBE(a_in: UInt32; const a_out: THashLibByteArray;
       a_index: Int32); overload; static; inline;
 
-    class procedure ReadUInt64AsBytesLE(a_in: UInt64; a_out: THashLibByteArray;
+    class procedure ReadUInt64AsBytesLE(a_in: UInt64; const a_out: THashLibByteArray;
       a_index: Int32); overload; static; inline;
 
-    class procedure ReadUInt64AsBytesBE(a_in: UInt64; a_out: THashLibByteArray;
+    class procedure ReadUInt64AsBytesBE(a_in: UInt64; const a_out: THashLibByteArray;
       a_index: Int32); overload; static; inline;
 
     class function ConvertStringToBytes(const a_in: String;
@@ -298,7 +298,7 @@ begin
 end;
 
 class procedure TConverters.ReadUInt32AsBytesLE(a_in: UInt32;
-  a_out: THashLibByteArray; a_index: Int32);
+  const a_out: THashLibByteArray; a_index: Int32);
 begin
   a_out[a_index] := Byte(a_in);
   a_out[a_index + 1] := Byte(a_in shr 8);
@@ -307,7 +307,7 @@ begin
 end;
 
 class procedure TConverters.ReadUInt32AsBytesBE(a_in: UInt32;
-  a_out: THashLibByteArray; a_index: Int32);
+  const a_out: THashLibByteArray; a_index: Int32);
 begin
   a_out[a_index] := Byte(a_in shr 24);
   a_out[a_index + 1] := Byte(a_in shr 16);
@@ -316,7 +316,7 @@ begin
 end;
 
 class procedure TConverters.ReadUInt64AsBytesLE(a_in: UInt64;
-  a_out: THashLibByteArray; a_index: Int32);
+  const a_out: THashLibByteArray; a_index: Int32);
 begin
   a_out[a_index] := Byte(a_in);
   a_out[a_index + 1] := Byte(a_in shr 8);
@@ -329,7 +329,7 @@ begin
 end;
 
 class procedure TConverters.ReadUInt64AsBytesBE(a_in: UInt64;
-  a_out: THashLibByteArray; a_index: Int32);
+  const a_out: THashLibByteArray; a_index: Int32);
 begin
   a_out[a_index] := Byte(a_in shr 56);
   a_out[a_index + 1] := Byte(a_in shr 48);

+ 4 - 0
src/libraries/hashlib4pascal/HlpMurmurHash3_x64_128.pas

@@ -449,6 +449,10 @@ begin
     begin
       ProcessPendings;
     end;
+  end
+  else
+  begin
+    i := 0;
   end;
 
   nBlocks := len shr 4;

+ 4 - 0
src/libraries/hashlib4pascal/HlpMurmurHash3_x86_128.pas

@@ -493,6 +493,10 @@ begin
     begin
       ProcessPendings;
     end;
+  end
+  else
+  begin
+    i := 0;
   end;
 
   nBlocks := len shr 4;

+ 4 - 3
src/libraries/hashlib4pascal/HlpMurmurHash3_x86_32.pas

@@ -232,7 +232,6 @@ begin
       ...
       idx = 2, len = 6 -> [0, 2[ + [0, 2[ => Block = [2,6[, buf []
       * }
-
 {$IFDEF DEBUG}
     System.Assert(a_index = 0); // nothing would work anyways if a_index is !=0
 {$ENDIF DEBUG}
@@ -250,6 +249,10 @@ begin
       TransformUInt32Fast(k);
       Fm_idx := 0;
     end;
+  end
+  else
+  begin
+    i := 0;
   end;
 
   nBlocks := len shr 2;
@@ -260,7 +263,6 @@ begin
   while i < nBlocks do
   begin
     k := TConverters.ReadBytesAsUInt32LE(ptr_a_data, a_index + (i * 4));
-
     TransformUInt32Fast(k);
 
     System.Inc(i);
@@ -270,7 +272,6 @@ begin
   offset := a_index + (i * 4);
   while offset < (len + a_index) do
   begin
-
     ByteUpdate(a_data[offset]);
     System.Inc(offset);
 

+ 4 - 0
src/libraries/hashlib4pascal/HlpSipHash.pas

@@ -323,6 +323,10 @@ begin
       ProcessBlock(m);
       Fm_idx := 0;
     end;
+  end
+  else
+  begin
+    i := 0;
   end;
 
   iter := Length shr 3;