Quellcode durchsuchen

* ensure that the power-of-2 size of the hash table is always larger than
the parameter initially passed to TFPHashList.SetCapacity after r15516
(mantis #16834)

git-svn-id: trunk@15521 -

Jonas Maebe vor 15 Jahren
Ursprung
Commit
434a6f6ee8
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      compiler/cclasses.pas

+ 1 - 1
compiler/cclasses.pas

@@ -1201,7 +1201,7 @@ var
 begin
   { use a power of two to be able to quickly calculate the hash table index }
   if NewCapacity <> 0 then
-    NewCapacity := nextpowerof2(NewCapacity div MaxItemsPerHash, power) * MaxItemsPerHash;
+    NewCapacity := nextpowerof2((NewCapacity+(MaxItemsPerHash-1)) div MaxItemsPerHash, power) * MaxItemsPerHash;
   if (NewCapacity < FCount) or (NewCapacity > MaxHashListSize) then
      Error (SListCapacityError, NewCapacity);
   if NewCapacity = FCapacity then