about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2015-01-03 10:44:54 +0100
committerAndrea Canciani <ranma42@gmail.com>2015-01-03 10:51:37 +0100
commit28cca28e623c1ac5a2a3e7dcdd31b3a90552c9eb (patch)
tree3ae0cb583ce95c74070b9ab81d168599e4d009a2 /src/libstd/sys/unix/stack_overflow.rs
parentfc2ba13939aa9672d886beb06efde7aeda2d5f7f (diff)
downloadrust-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