forked from boostorg/unordered
Use std::max.
[SVN r56349]
This commit is contained in:
@ -417,10 +417,9 @@ namespace boost { namespace unordered_detail {
|
|||||||
inline bool hash_table<H, P, A, G, K>::reserve_for_insert(std::size_t size)
|
inline bool hash_table<H, P, A, G, K>::reserve_for_insert(std::size_t size)
|
||||||
{
|
{
|
||||||
if(size >= max_load_) {
|
if(size >= max_load_) {
|
||||||
std::size_t s = this->size_;
|
|
||||||
s = s + (s >> 1);
|
|
||||||
std::size_t num_buckets
|
std::size_t num_buckets
|
||||||
= this->min_buckets_for_size(s > size ? s : size);
|
= this->min_buckets_for_size((std::max)(size,
|
||||||
|
this->size_ + (this->size_ >> 1)));
|
||||||
if(num_buckets != this->bucket_count_) {
|
if(num_buckets != this->bucket_count_) {
|
||||||
rehash_impl(num_buckets);
|
rehash_impl(num_buckets);
|
||||||
return true;
|
return true;
|
||||||
@ -446,9 +445,9 @@ namespace boost { namespace unordered_detail {
|
|||||||
else {
|
else {
|
||||||
// no throw:
|
// no throw:
|
||||||
// TODO: Needlessly calling next_prime twice.
|
// TODO: Needlessly calling next_prime twice.
|
||||||
std::size_t min_size = this->min_buckets_for_size(this->size_);
|
min_buckets = (std::max)(
|
||||||
min_buckets = next_prime(min_buckets);
|
next_prime(min_buckets),
|
||||||
min_buckets = min_size > min_buckets ? min_size : min_buckets;
|
this->min_buckets_for_size(this->size_));
|
||||||
if(min_buckets != this->bucket_count_) rehash_impl(min_buckets);
|
if(min_buckets != this->bucket_count_) rehash_impl(min_buckets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user