Grow the map by a factor of two keeping bucket_count to a power of two. It allows the map to use a mask operation instead of a modulo operation to map a hash to a bucket.
Definition at line 73 of file hopscotch_hash.h.
#include <hopscotch_hash.h>
|
static std::size_t | round_up_to_power_of_two (std::size_t value) |
|
static constexpr bool | is_power_of_two (std::size_t value) |
|
|
static const std::size_t | MIN_BUCKETS_SIZE = 2 |
|
◆ power_of_two_growth_policy()
tsl::power_of_two_growth_policy::power_of_two_growth_policy |
( |
std::size_t & |
min_bucket_count_in_out | ) |
|
|
inline |
Called on map creation and rehash. The number of buckets requested is passed by parameter. This number is a minimum, the policy may update this value with a higher value if needed.
Definition at line 79 of file hopscotch_hash.h.
◆ bucket_for_hash()
std::size_t tsl::power_of_two_growth_policy::bucket_for_hash |
( |
std::size_t |
hash | ) |
const |
|
inline |
Return the bucket [0, bucket_count()) to which the hash belongs.
Definition at line 95 of file hopscotch_hash.h.
◆ max_bucket_count()
std::size_t tsl::power_of_two_growth_policy::max_bucket_count |
( |
| ) |
const |
|
inline |
Return the maximum number of buckets supported by the policy.
Definition at line 113 of file hopscotch_hash.h.
◆ next_bucket_count()
std::size_t tsl::power_of_two_growth_policy::next_bucket_count |
( |
| ) |
const |
|
inline |
Return the bucket count to uses when the bucket array grows on rehash.
Definition at line 102 of file hopscotch_hash.h.
The documentation for this class was generated from the following file: