Sierra Toolkit
Version of the Day
|
#include <hashtable_eastl.h>
Public Member Functions | |
prime_rehash_policy (float fMaxLoadFactor=1.f) | |
float | GetMaxLoadFactor () const |
uint32_t | GetPrevBucketCount (uint32_t nBucketCountHint) const |
uint32_t | GetNextBucketCount (uint32_t nBucketCountHint) const |
uint32_t | GetBucketCount (uint32_t nElementCount) const |
eastl::pair< bool, uint32_t > | GetRehashRequired (uint32_t nBucketCount, uint32_t nElementCount, uint32_t nElementAdd) const |
Static Public Member Functions | |
static uint32_t | GetPrevBucketCountOnly (uint32_t nBucketCountHint) |
Public Attributes | |
float | mfMaxLoadFactor |
float | mfGrowthFactor |
uint32_t | mnNextResize |
Default value for rehash policy. Bucket size is (usually) the smallest prime that keeps the load factor small enough.
Definition at line 381 of file hashtable_eastl.h.
|
static |
Return a bucket count no greater than nBucketCountHint, Don't update member variables while at it.
GetPrevBucketCountOnly Return a bucket count no greater than nBucketCountHint.
Definition at line 127 of file hashtable_eastl.cpp.
uint32_t eastl::prime_rehash_policy::GetPrevBucketCount | ( | uint32_t | nBucketCountHint | ) | const |
Return a bucket count no greater than nBucketCountHint. This function has a side effect of updating mnNextResize.
GetPrevBucketCount Return a bucket count no greater than nBucketCountHint. This function has a side effect of updating mnNextResize.
Definition at line 138 of file hashtable_eastl.cpp.
uint32_t eastl::prime_rehash_policy::GetNextBucketCount | ( | uint32_t | nBucketCountHint | ) | const |
Return a bucket count no smaller than nBucketCountHint. This function has a side effect of updating mnNextResize.
GetNextBucketCount Return a prime no smaller than nBucketCountHint. This function has a side effect of updating mnNextResize.
Definition at line 151 of file hashtable_eastl.cpp.
uint32_t eastl::prime_rehash_policy::GetBucketCount | ( | uint32_t | nElementCount | ) | const |
Return a bucket count appropriate for nElementCount elements. This function has a side effect of updating mnNextResize.
GetBucketCount Return the smallest prime p such that alpha p >= nElementCount, where alpha is the load factor. This function has a side effect of updating mnNextResize.
Definition at line 164 of file hashtable_eastl.cpp.
eastl::pair< bool, uint32_t > eastl::prime_rehash_policy::GetRehashRequired | ( | uint32_t | nBucketCount, |
uint32_t | nElementCount, | ||
uint32_t | nElementAdd | ||
) | const |
nBucketCount is current bucket count, nElementCount is current element count, and nElementAdd is number of elements to be inserted. Do we need to increase bucket count? If so, return pair(true, n), where n is the new bucket count. If not, return pair(false, 0).
GetRehashRequired Finds the smallest prime p such that alpha p > nElementCount + nElementAdd. If p > nBucketCount, return pair<bool, uint32_t>(true, p); otherwise return pair<bool, uint32_t>(false, 0). In principle this isn't very different from GetBucketCount. This function has a side effect of updating mnNextResize.
Definition at line 181 of file hashtable_eastl.cpp.