Skip to content

Instantly share code, notes, and snippets.

@Deguerre
Created August 19, 2025 02:21
Show Gist options
  • Select an option

  • Save Deguerre/5e160904da21c5b29e739fb885ecbafb to your computer and use it in GitHub Desktop.

Select an option

Save Deguerre/5e160904da21c5b29e739fb885ecbafb to your computer and use it in GitHub Desktop.
namespace detail {
constexpr uint64_t sHashLo1 = 0x124b34c732f4a485ull;
constexpr uint64_t sHashLo2 = 0x6fafc7de1f728990ull;
constexpr uint64_t sHashLo3 = 0x9299b5768ee5e36dull;
constexpr uint64_t sHashHi1 = 0x4d8271fe7646891full;
constexpr uint64_t sHashHi2 = 0x6d48b8a30939437cull;
constexpr uint64_t sHashHi3 = 0x122f44ec3b08f41cull;
}
uint64_t hash_word(uint64_t hash, uint64_t w)
{
uint64_t whi = w >> 32;
uint64_t wlo = w & 0xFFFFFFFF;
uint64_t hashlo = (detail::sHashLo1 * whi + detail::sHashLo2 * wlo + detail::sHashLo3 * hash) >> 32;
uint64_t hashhi = (detail::sHashHi1 * whi + detail::sHashHi2 * wlo + detail::sHashHi3 * hash) >> 32;
return hashlo | (hashhi << 32);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment