From 208168f300cc1bef789b35a85aa0f867533f0fbd Mon Sep 17 00:00:00 2001 From: fdumont Date: Thu, 30 Apr 2015 07:13:37 +0000 Subject: [PATCH] =?utf8?q?2015-04-30=20=20Fran=C3=A7ois=20Dumont=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * include/bits/hashtable_policy.h (_Prime_rehash_policy::_S_n_primes): Delete. * src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt): Remove usage of latter and compute size of the prime numbers array locally. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222611 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/hashtable_policy.h | 2 -- libstdc++-v3/src/c++11/hashtable_c++0x.cc | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5b509f79cf2..02b07ac0a9e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2015-04-30 François Dumont + + * include/bits/hashtable_policy.h (_Prime_rehash_policy::_S_n_primes): + Delete. + * src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt): + Remove usage of latter and compute size of the prime numbers array + locally. + 2015-04-29 Doug Evans PR libstdc++/65839 diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 14bcca6562c..a9ad7dd89f6 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -495,8 +495,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_reset(_State __state) { _M_next_resize = __state; } - enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 }; - static const std::size_t _S_growth_factor = 2; float _M_max_load_factor; diff --git a/libstdc++-v3/src/c++11/hashtable_c++0x.cc b/libstdc++-v3/src/c++11/hashtable_c++0x.cc index 22de51bba0f..69f999f5cd5 100644 --- a/libstdc++-v3/src/c++11/hashtable_c++0x.cc +++ b/libstdc++-v3/src/c++11/hashtable_c++0x.cc @@ -56,8 +56,10 @@ namespace __detail return __fast_bkt[__n]; } + constexpr auto __n_primes + = sizeof(__prime_list) / sizeof(unsigned long) - 1; const unsigned long* __next_bkt = - std::lower_bound(__prime_list + 5, __prime_list + _S_n_primes, __n); + std::lower_bound(__prime_list + 5, __prime_list + __n_primes, __n); _M_next_resize = __builtin_ceil(*__next_bkt * (long double)_M_max_load_factor); return *__next_bkt; -- 2.11.4.GIT