lemireHash64

Inspired by lemire's strongly universal hashing.

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

Examples

assert(lemireHash64(0) == 0UL);
assert(lemireHash64(1) == 10826341276197359097UL);
assert(lemireHash64(2) == 3205938474390199283UL);

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