diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/digest/sfh/sfh.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/digest/sfh/sfh.h')
-rw-r--r-- | library/cpp/digest/sfh/sfh.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/digest/sfh/sfh.h b/library/cpp/digest/sfh/sfh.h index cce9558916..372938654c 100644 --- a/library/cpp/digest/sfh/sfh.h +++ b/library/cpp/digest/sfh/sfh.h @@ -4,37 +4,37 @@ #include <util/system/unaligned_mem.h> inline ui32 SuperFastHash(const void* d, size_t l) noexcept { - ui32 hash = (ui32)l; - ui32 tmp; + ui32 hash = (ui32)l; + ui32 tmp; - if (!l || !d) + if (!l || !d) return 0; - TUnalignedMemoryIterator<ui16, 4> iter(d, l); + TUnalignedMemoryIterator<ui16, 4> iter(d, l); - while (!iter.AtEnd()) { - hash += (ui32)iter.Next(); - tmp = ((ui32)iter.Next() << 11) ^ hash; - hash = (hash << 16) ^ tmp; - hash += hash >> 11; + while (!iter.AtEnd()) { + hash += (ui32)iter.Next(); + tmp = ((ui32)iter.Next() << 11) ^ hash; + hash = (hash << 16) ^ tmp; + hash += hash >> 11; } - switch (iter.Left()) { - case 3: - hash += (ui32)iter.Next(); + switch (iter.Left()) { + case 3: + hash += (ui32)iter.Next(); hash ^= hash << 16; - hash ^= ((ui32)(i32) * (const i8*)iter.Last()) << 18; + hash ^= ((ui32)(i32) * (const i8*)iter.Last()) << 18; hash += hash >> 11; break; - - case 2: - hash += (ui32)iter.Cur(); + + case 2: + hash += (ui32)iter.Cur(); hash ^= hash << 11; hash += hash >> 17; break; - - case 1: - hash += *((const i8*)iter.Last()); + + case 1: + hash += *((const i8*)iter.Last()); hash ^= hash << 10; hash += hash >> 1; } |