mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-04 15:10:42 +08:00
hashtable_policy.h (_Prime_rehash_policy:: _S_n_primes): Add.
2007-12-05 Paolo Carlini <pcarlini@suse.de> * include/tr1_impl/hashtable_policy.h (_Prime_rehash_policy:: _S_n_primes): Add. (_Prime_rehash_policy::_M_next_bkt, _M_bkt_for_elements, _M_need_rehash): Adjust. From-SVN: r130628
This commit is contained in:
parent
3898fe8e7c
commit
bce623434f
@ -1,3 +1,10 @@
|
||||
2007-12-05 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/tr1_impl/hashtable_policy.h (_Prime_rehash_policy::
|
||||
_S_n_primes): Add.
|
||||
(_Prime_rehash_policy::_M_next_bkt, _M_bkt_for_elements,
|
||||
_M_need_rehash): Adjust.
|
||||
|
||||
2007-12-03 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* src/hashtable.cc (__prime_list): Use __SIZEOF_LONG__.
|
||||
|
@ -405,7 +405,9 @@ namespace __detail
|
||||
std::pair<bool, std::size_t>
|
||||
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
|
||||
std::size_t __n_ins) const;
|
||||
|
||||
|
||||
enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 };
|
||||
|
||||
float _M_max_load_factor;
|
||||
float _M_growth_factor;
|
||||
mutable std::size_t _M_next_resize;
|
||||
@ -421,9 +423,8 @@ namespace __detail
|
||||
_Prime_rehash_policy::
|
||||
_M_next_bkt(std::size_t __n) const
|
||||
{
|
||||
const int __n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48;
|
||||
const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
|
||||
+ __n_primes, __n);
|
||||
+ _S_n_primes, __n);
|
||||
_M_next_resize = static_cast<std::size_t>(std::ceil(*__p
|
||||
* _M_max_load_factor));
|
||||
return *__p;
|
||||
@ -435,10 +436,9 @@ namespace __detail
|
||||
_Prime_rehash_policy::
|
||||
_M_bkt_for_elements(std::size_t __n) const
|
||||
{
|
||||
const int __n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48;
|
||||
const float __min_bkts = __n / _M_max_load_factor;
|
||||
const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
|
||||
+ __n_primes, __min_bkts);
|
||||
+ _S_n_primes, __min_bkts);
|
||||
_M_next_resize = static_cast<std::size_t>(std::ceil(*__p
|
||||
* _M_max_load_factor));
|
||||
return *__p;
|
||||
@ -465,9 +465,8 @@ namespace __detail
|
||||
if (__min_bkts > __n_bkt)
|
||||
{
|
||||
__min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt);
|
||||
const int __n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48;
|
||||
const unsigned long* __p =
|
||||
std::lower_bound(__prime_list, __prime_list + __n_primes,
|
||||
std::lower_bound(__prime_list, __prime_list + _S_n_primes,
|
||||
__min_bkts);
|
||||
_M_next_resize =
|
||||
static_cast<std::size_t>(std::ceil(*__p * _M_max_load_factor));
|
||||
|
Loading…
Reference in New Issue
Block a user