@@ -191,15 +191,17 @@ function BytesToIndexHash;
191191// convert entry_chars to hash
192192// use Prime: Integer = 75013;
193193var
194- G: Integer ;
194+ G: Cardinal ;
195195 i: Integer;
196- Hash: Integer ;
196+ Hash: Cardinal ;
197197begin
198198 Hash := 0 ;
199- for i := 0 to entry_name_array_length - 1 do
199+ // for i := 0 to entry_name_array_length - 1 do
200+ for i := entry_name_array_length - 1 downto 0 do
200201 begin
201202 Hash := (Hash shl 4 ) + entry_name_array[i];
202203 G := Hash and $F0000000;
204+ // G := Hash and $F000000;
203205 if (G <> 0 ) then
204206 Hash := (Hash xor (G shr 24 )) xor G;
205207 end ;
@@ -310,9 +312,9 @@ procedure HashAndSave;
310312 end
311313 else // collision, try next spot in HashMap array
312314 begin
313- Inc( entry_hash) ;
314- if entry_hash >= Prime then
315- entry_hash := 0 ; // wrap around
315+ entry_hash := entry_hash + 19 ;
316+ if entry_hash >= Prime then // wrap around
317+ entry_hash := entry_hash - Prime;
316318 end ;
317319 end ;
318320 end ; // of: while True do
@@ -321,13 +323,11 @@ procedure HashAndSave;
321323
322324procedure FileToArrays (inFile: String; UseStdOut: Boolean); inline;
323325var
324- PlaceIndex: Integer; // location in index array
325326 i: Integer; // used for temporary purposes
326327
327328 LF: Boolean; // True after finding #10
328329 SC: Boolean; // True after finding semi-colon
329330
330- iFileHandle: Integer;
331331 iBytesRead: Integer;
332332 Buffer: PByte;
333333
@@ -342,7 +342,6 @@ procedure FileToArrays(inFile: String; UseStdOut: Boolean); inline;
342342
343343 // Load the data
344344 PlaceCount := 0 ;
345- PlaceIndex := 0 ;
346345 InitializeThings;
347346
348347 if FileExists(inFile) then
0 commit comments