diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-31 00:52:57 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-31 00:52:57 +0000 |
commit | 943cc2a1b70f2d755b4fed97b1c4b49234d92899 (patch) | |
tree | e80887a7fb15d206dd22375cb9650766db27e2f4 /libstdc++-v3/src | |
parent | afb8da7faa9dfe5a0d94ed45a373d74c076784ab (diff) | |
download | gcc-943cc2a1b70f2d755b4fed97b1c4b49234d92899.zip gcc-943cc2a1b70f2d755b4fed97b1c4b49234d92899.tar.gz gcc-943cc2a1b70f2d755b4fed97b1c4b49234d92899.tar.bz2 |
libstdc++: Use double for unordered container load factors [PR 96958]
My previous commit for this PR changed the types from long double to
double, but didn't change the uses of __builtin_ceill and
__builtin_floorl. It also failed to change the non-inline functions in
src/c++11/hashtable_c++0x.cc. This should fix it properly now.
libstdc++-v3/ChangeLog:
PR libstdc++/96958
* include/bits/hashtable_policy.h (_Prime_rehash_policy)
(_Power2_rehash_policy): Use ceil and floor instead of ceill and
floorl.
* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy): Likewise.
Use double instead of long double.
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/c++11/hashtable_c++0x.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libstdc++-v3/src/c++11/hashtable_c++0x.cc b/libstdc++-v3/src/c++11/hashtable_c++0x.cc index 62762f3..4dec2a8 100644 --- a/libstdc++-v3/src/c++11/hashtable_c++0x.cc +++ b/libstdc++-v3/src/c++11/hashtable_c++0x.cc @@ -58,7 +58,7 @@ namespace __detail return 1; _M_next_resize = - __builtin_floorl(__fast_bkt[__n] * (long double)_M_max_load_factor); + __builtin_floor(__fast_bkt[__n] * (double)_M_max_load_factor); return __fast_bkt[__n]; } @@ -81,7 +81,7 @@ namespace __detail _M_next_resize = size_t(-1); else _M_next_resize = - __builtin_floorl(*__next_bkt * (long double)_M_max_load_factor); + __builtin_floor(*__next_bkt * (double)_M_max_load_factor); return *__next_bkt; } @@ -105,16 +105,16 @@ namespace __detail // If _M_next_resize is 0 it means that we have nothing allocated so // far and that we start inserting elements. In this case we start // with an initial bucket size of 11. - long double __min_bkts + double __min_bkts = std::max<std::size_t>(__n_elt + __n_ins, _M_next_resize ? 0 : 11) - / (long double)_M_max_load_factor; + / (double)_M_max_load_factor; if (__min_bkts >= __n_bkt) return { true, - _M_next_bkt(std::max<std::size_t>(__builtin_floorl(__min_bkts) + 1, + _M_next_bkt(std::max<std::size_t>(__builtin_floor(__min_bkts) + 1, __n_bkt * _S_growth_factor)) }; _M_next_resize - = __builtin_floorl(__n_bkt * (long double)_M_max_load_factor); + = __builtin_floor(__n_bkt * (double)_M_max_load_factor); return { false, 0 }; } else |