hash policy patch

François Dumont francois.cppdevs@free.fr
Sun Jul 24 19:33:00 GMT 2011


On 07/24/2011 01:31 AM, Paolo Carlini wrote:
> On 07/23/2011 10:31 PM, François Dumont wrote:
>> Hi
>>
>>     While working on DR 41975 I realized a small issue in current 
>> rehash implementation that sometimes lead to load_factor being 
>> greater than max_load_factor. Here is a patch to fix that:
> Ok, good.
>
> I think we could as well have everywhere:
>
>     const unsigned long __p = *std::lower_bound...
>
> and then change the following *__p to __p. Isn't a tad cleaner?
>
> Thanks,
> Paolo.
>
Attached patch applied, I have integrated your remark Paolo.

2011-07-24  François Dumont <francois.cppdevs@free.fr>

         * include/bits/hashtable_policy.h (_Prime_rehash_policy): Use
         __builtin_floor rather than __builtin_ceil to compute next resize
         value.
         * testsuite/23_containers/unordered_set/hash_policy/load_factor.cc:
         New.

For info, I will submit a proposal for DR 41975 tomorrow or the day after.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hash_policy.patch
Type: text/x-patch
Size: 3890 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110724/52281d79/attachment.bin>


More information about the Libstdc++ mailing list