This commit is contained in:
Ben Judd 2021-04-18 16:06:05 -07:00
parent 161ca6d4d1
commit 56875088d4

View File

@ -55,10 +55,8 @@ size_t hash_data(const char* input, size_t len)
uint32_t key = 0; uint32_t key = 0;
switch (len & 0b11) switch (len & 0b11)
{ {
case 3: key ^= tail[2] << 16; case 3: key ^= tail[2] << 16; [[fallthrough]];
[[fallthrough]]; case 2: key ^= tail[1] << 8; [[fallthrough]];
case 2: key ^= tail[1] << 8;
[[fallthrough]];
case 1: key ^= tail[0]; case 1: key ^= tail[0];
key *= c1; key *= c1;
key = rotl(key,15); key = rotl(key,15);
@ -72,7 +70,7 @@ size_t hash_data(const char* input, size_t len)
return hash; return hash;
} }
UnitTest test_murmer_hash{[] { UnitTest test_murmur_hash{[] {
{ {
constexpr char data[] = "Hello, World!"; constexpr char data[] = "Hello, World!";
kak_assert(hash_data(data, strlen(data)) == 0xf816f95b); kak_assert(hash_data(data, strlen(data)) == 0xf816f95b);