OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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>

+ Inheritance diagram for tsl::power_of_two_growth_policy:

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)
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.

Member Function Documentation

◆ 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.

◆ is_power_of_two()

static constexpr bool tsl::power_of_two_growth_policy::is_power_of_two ( std::size_t  value)
inlinestaticconstexprprivate

Definition at line 135 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.

◆ round_up_to_power_of_two()

static std::size_t tsl::power_of_two_growth_policy::round_up_to_power_of_two ( std::size_t  value)
inlinestaticprivate

Definition at line 118 of file hopscotch_hash.h.

Field Documentation

◆ m_mask

std::size_t tsl::power_of_two_growth_policy::m_mask
private

Definition at line 142 of file hopscotch_hash.h.

◆ MIN_BUCKETS_SIZE

const std::size_t tsl::power_of_two_growth_policy::MIN_BUCKETS_SIZE = 2
staticprivate

Definition at line 140 of file hopscotch_hash.h.


The documentation for this class was generated from the following file: