lemireHash64

Inspired by lemire's strongly universal hashing.

  1. ulong lemireHash64(ulong x)
  2. ulong lemireHash64(double x)
    @safe nothrow pure @nogc @nogc @trusted
    ulong
    lemireHash64
    (
    in double x
    )

Examples

assert(lemireHash64(0f) == 0UL);
assert(lemireHash64(1f) == 5597974336836488763);
assert(lemireHash64(2f) == 4611686018555721673UL);

See Also

https://lemire.me/blog/2018/08/15/fast-strongly-universal-64-bit-hashing-everywhere/

Instead of shifts, we use rotations so we don't lose any bits.

Added a final multiplcation with a constant for more mixing. It is most important that the lower bits are well mixed.

Meta