Lumiera
0.pre.03
»edit your freedom«
|
Functions | |
LuidH | buildHash (string const &sym, HashVal seed=0) |
build up a hash value, packaged as LUID. More... | |
Variables | |
const size_t | KNUTH_MAGIC = 2654435761 |
lousy old tinkerer's trick: hash values with poor distribution can be improved by spreading the input with something close to the golden ratio. More... | |
|
inline |
build up a hash value, packaged as LUID.
sym | symbolic ID-string to be hashed |
seed | (optional) hash value to combine with the sym. |
size_t
. This hack here assumes that size_t corresponds to void*, which is correct for i386 and AMD64. LUID provides a hook for embedding a void* (setting the trailing bits to zero). Finally we reinterpret the char[] of the LUID as a LuidH class, which is ugly, but granted to work. Definition at line 108 of file entry-id.hpp.
References lumiera_uid_set_ptr().
Referenced by EntryID< StreamType >::canRecast().
const size_t KNUTH_MAGIC = 2654435761 |
lousy old tinkerer's trick: hash values with poor distribution can be improved by spreading the input with something close to the golden ratio.
Additionally, the scaling factor (for hashing) should be prime. 2^32 * (√5-1)/2 = 2654435769.49723
Definition at line 83 of file entry-id.hpp.
Referenced by HashGenerator_test::verify_Knuth_workaround().