Skip to content

Instantly share code, notes, and snippets.

@zeux
Last active March 20, 2021 23:05
Show Gist options
  • Save zeux/25b490b07b4873efc08bd37c843777a4 to your computer and use it in GitHub Desktop.
Save zeux/25b490b07b4873efc08bd37c843777a4 to your computer and use it in GitHub Desktop.
MurMurHash finalizers as 32-bit integer/pointer hashers
uint32_t murmur2(uint32_t h)
{
h ^= h >> 13;
h *= 0x5bd1e995;
h ^= h >> 15;
return h;
}
uint32_t murmur3(uint32_t h)
{
h ^= h >> 16;
h *= 0x85ebca6bu;
h ^= h >> 13;
h *= 0xc2b2ae35u;
h ^= h >> 16;
return h;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment