Переглянути джерело

* 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 15 роки тому
батько
коміт
434a6f6ee8
1 змінених файлів з 1 додано та 1 видалено
  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