diff options
| author | Andrea Canciani <ranma42@gmail.com> | 2015-01-03 10:44:54 +0100 |
|---|---|---|
| committer | Andrea Canciani <ranma42@gmail.com> | 2015-01-03 10:51:37 +0100 |
| commit | 28cca28e623c1ac5a2a3e7dcdd31b3a90552c9eb (patch) | |
| tree | 3ae0cb583ce95c74070b9ab81d168599e4d009a2 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | fc2ba13939aa9672d886beb06efde7aeda2d5f7f (diff) | |
| download | rust-28cca28e623c1ac5a2a3e7dcdd31b3a90552c9eb.tar.gz rust-28cca28e623c1ac5a2a3e7dcdd31b3a90552c9eb.zip | |
Improve `make_hash` function
The `make_hash` function is used to prevent hashes of non-empty buckets to collide with `EMPTY_HASH = 0u64`. Ideally this function also preserve the uniform distribution of hashes and is cheap to compute. The new implementation reduces the input hash size by one bit, simply by setting the most significant bit. This obviously prevent output hashes to collide with `EMPTY_HASH` and guarantees that the uniform distribution is preserved. Moreover, the new function is simpler (no comparisons, just an OR) and (under the same assumptions as the old function, i.e. only the least significant bit will contribute to the bucket index) no additional collisions are caused.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
