Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hash: Improve hash function for integers.
As previously defined, the following both returned the same value for given values of 'basis': hash_int(0, hash_int(1, basis)) hash_int(1, hash_int(0, basis)) because hash_int(0, basis) evaluated to basis and hash_int(1, basis) evaluated to c + basis for some constant c. This commit fixes the problem, by eliminating any simple linear relationship between basis and the hash value. We should write some tests for hash function quality.
- Loading branch information