Fix comments in simplehash.h.
Jeff Janes and me. Discussion: https://www.postgresql.org/message-id/CAMkU=1zYnniLYg+W9itL93DXebCjx6Uk6m_=Xa8p_zM65X3S0Q@mail.gmail.com
This commit is contained in:
parent
e7941a9766
commit
553e16951c
@ -214,12 +214,12 @@ SH_COMPUTE_PARAMETERS(SH_TYPE * tb, uint32 newsize)
|
|||||||
/* supporting zero sized hashes would complicate matters */
|
/* supporting zero sized hashes would complicate matters */
|
||||||
size = Max(newsize, 2);
|
size = Max(newsize, 2);
|
||||||
|
|
||||||
/* round up size to the next power of 2, that's the bucketing works */
|
/* round up size to the next power of 2, that's how bucketing works */
|
||||||
size = sh_pow2(size);
|
size = sh_pow2(size);
|
||||||
Assert(size <= SH_MAX_SIZE);
|
Assert(size <= SH_MAX_SIZE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify allocation of ->data is possible on platform, without
|
* Verify that allocation of ->data is possible on this platform, without
|
||||||
* overflowing Size.
|
* overflowing Size.
|
||||||
*/
|
*/
|
||||||
if ((((uint64) sizeof(SH_ELEMENT_TYPE)) * size) >= MaxAllocHugeSize)
|
if ((((uint64) sizeof(SH_ELEMENT_TYPE)) * size) >= MaxAllocHugeSize)
|
||||||
@ -234,8 +234,8 @@ SH_COMPUTE_PARAMETERS(SH_TYPE * tb, uint32 newsize)
|
|||||||
tb->sizemask = tb->size - 1;
|
tb->sizemask = tb->size - 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute growth threshold here and after growing the table, to make
|
* Compute the next threshold at which we need to grow the hash table
|
||||||
* computations during insert cheaper.
|
* again.
|
||||||
*/
|
*/
|
||||||
if (tb->size == SH_MAX_SIZE)
|
if (tb->size == SH_MAX_SIZE)
|
||||||
tb->grow_threshold = ((double) tb->size) * SH_MAX_FILLFACTOR;
|
tb->grow_threshold = ((double) tb->size) * SH_MAX_FILLFACTOR;
|
||||||
@ -696,7 +696,7 @@ SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key)
|
|||||||
* or an element at its optimal position is encountered.
|
* or an element at its optimal position is encountered.
|
||||||
*
|
*
|
||||||
* While that sounds expensive, the average chain length is short,
|
* While that sounds expensive, the average chain length is short,
|
||||||
* and deletions would otherwise require toombstones.
|
* and deletions would otherwise require tombstones.
|
||||||
*/
|
*/
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user