|
| | CityHash (float bucketRatio=0.75f) |
| | Constructs an instance of the CityHash class. More...
|
| |
| uint64_t | Hash (std::string_view data) const noexcept override |
| | Compute the hash of a given string of bytes. More...
|
| |
| size_t | CalcBucket (uint64_t hash, size_t bucketCount) const noexcept override |
| | Calculates the bucket to index given a hash and total bucket size. More...
|
| |
| size_t | CalcBucketsForItemCount (size_t count) const noexcept override |
| | Calculates the total number of buckets that should be created for total file count. More...
|
| |
◆ CityHash()
| AssetMap::CityHash::CityHash |
( |
float |
bucketRatio = 0.75f | ) |
|
|
explicit |
Constructs an instance of the CityHash class.
This class does not allocate anything. An optional bucket ratio can be specified which is used by CalcBucketsForItemCount.
- Parameters
-
| bucketRatio | Specifies the desired ratio of items:buckets. |
◆ CalcBucket()
| size_t AssetMap::CityHash::CalcBucket |
( |
uint64_t |
hash, |
|
|
size_t |
bucketCount |
|
) |
| const |
|
overridevirtualnoexcept |
Calculates the bucket to index given a hash and total bucket size.
The exact method of calculation uses floating point operations as this produced mildly better distribution of buckets.
- Parameters
-
| hash | A hash previously obtained through a call to CityHash::Hash |
| bucketCount | The total number of buckets that exist. |
- Returns
- A value in the range 0 to
bucketCount-1
Implements AssetMap::IHasher.
◆ CalcBucketsForItemCount()
| size_t AssetMap::CityHash::CalcBucketsForItemCount |
( |
size_t |
count | ) |
const |
|
overridevirtualnoexcept |
Calculates the total number of buckets that should be created for total file count.
This implementation simply takes count and divides it by bucketRatio
- Parameters
-
| count | The total number of entries that will be hashed. |
- Returns
- A value indicating the preferred number of buckets.
Implements AssetMap::IHasher.
◆ Hash()
| uint64_t AssetMap::CityHash::Hash |
( |
std::string_view |
data | ) |
const |
|
overridevirtualnoexcept |
Compute the hash of a given string of bytes.
- Parameters
-
| data | A string of data to digest. |
- Returns
- A 64-bit hash computed by CityHash.
Implements AssetMap::IHasher.
The documentation for this class was generated from the following file: