rt/aaA.d Line: 553

Paul Backus snarwin at gmail.com
Fri Feb 14 23:19:31 UTC 2020


On Friday, 14 February 2020 at 22:57:31 UTC, Ferhat Kurtulmuş 
wrote:
> findSlotInsert are called two times. Why not:
>
>     if (++aa.used * GROW_DEN > aa.dim * GROW_NUM)
>         aa.grow(ti.key);
>
>     auto p = aa.findSlotInsert(hash); // only one call is 
> enough?
>
>     if (p.deleted)
>         --aa.deleted;
> ...
>
> If I am not wrong this modification will not corrupt the 
> current state of the hash table?

`used` counts both filled and deleted buckets, so it shouldn't be 
incremented when changing a deleted bucket into a filled bucket.


More information about the Digitalmars-d-learn mailing list