OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
tsl::power_of_two_growth_policy Class Reference

Detailed Description

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>

Public Member Functions

 power_of_two_growth_policy (std::size_t &min_bucket_count_in_out)
std::size_t bucket_for_hash (std::size_t hash) const
std::size_t next_bucket_count () const
std::size_t max_bucket_count () const

Static Private Member Functions

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)

Private Attributes

std::size_t m_mask

Static Private Attributes

static const std::size_t MIN_BUCKETS_SIZE = 2

Constructor & Destructor Documentation

◆ power_of_two_growth_policy()

tsl::power_of_two_growth_policy::power_of_two_growth_policy ( std::size_t &  min_bucket_count_in_out)

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.

Member Function Documentation

◆ bucket_for_hash()

std::size_t tsl::power_of_two_growth_policy::bucket_for_hash ( std::size_t  hash) const

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

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

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: