Expand description
String-dim hashing helper shared between curve normalization and tile-index bucketing.
Both super::normalize (when projecting String coords onto a
space-filling curve) and crate::tile::layout (when bucketing
String coords into tile indices) need the same per-process
mapping from a string to an integer. Centralising it here keeps
their assignments consistent within a process and gives a single
site to swap for sort-preserving codes later.
RandomState is per-process; bucket assignments are NOT stable
across restarts. Future work may upgrade to a deterministic
dictionary code.
Functions§
- hash_
string_ masked - Hash
sinto the range[0, bound](inclusive) by masking withbound. Caller passesbound = (1 << bits) - 1for power-of-two curve buckets, orextent - 1style values for tile bucketing (wherebound + 1is a power of two); for arbitrarybound, callers should usehash_string_moduloinstead. - hash_
string_ modulo - Hash
sinto[0, modulus)via modulo. Used by tile-index bucketing where the extent isn’t necessarily a power of two.