aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/sfh/sfh.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/digest/sfh/sfh.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/sfh/sfh.h')
-rw-r--r--library/cpp/digest/sfh/sfh.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/digest/sfh/sfh.h b/library/cpp/digest/sfh/sfh.h
index 372938654c..cce9558916 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;
}