diff options
| author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:15 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:15 +0300 | 
| commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
| tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/digest/sfh | |
| parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/sfh')
| -rw-r--r-- | library/cpp/digest/sfh/sfh.cpp | 2 | ||||
| -rw-r--r-- | library/cpp/digest/sfh/sfh.h | 38 | ||||
| -rw-r--r-- | library/cpp/digest/sfh/sfh_ut.cpp | 76 | ||||
| -rw-r--r-- | library/cpp/digest/sfh/ut/ya.make | 14 | ||||
| -rw-r--r-- | library/cpp/digest/sfh/ya.make | 16 | 
5 files changed, 73 insertions, 73 deletions
diff --git a/library/cpp/digest/sfh/sfh.cpp b/library/cpp/digest/sfh/sfh.cpp index c10062105b5..c36724a3f19 100644 --- a/library/cpp/digest/sfh/sfh.cpp +++ b/library/cpp/digest/sfh/sfh.cpp @@ -1 +1 @@ -#include "sfh.h" +#include "sfh.h"  diff --git a/library/cpp/digest/sfh/sfh.h b/library/cpp/digest/sfh/sfh.h index 372938654cb..cce95589168 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;      } diff --git a/library/cpp/digest/sfh/sfh_ut.cpp b/library/cpp/digest/sfh/sfh_ut.cpp index 912999bae75..79606232de3 100644 --- a/library/cpp/digest/sfh/sfh_ut.cpp +++ b/library/cpp/digest/sfh/sfh_ut.cpp @@ -1,40 +1,40 @@ -#include "sfh.h" - +#include "sfh.h"  +   #include <library/cpp/testing/unittest/registar.h> - +   #include <util/stream/output.h> - -class TSfhTest: public TTestBase { -    UNIT_TEST_SUITE(TSfhTest); -    UNIT_TEST(TestSfh) -    UNIT_TEST_SUITE_END(); - -private: -    inline void TestSfh() { -        ui8 buf[256]; - -        for (size_t i = 0; i < 256; ++i) { -            buf[i] = i; -        } - -        Test(buf, 256, 3840866583UL); -        Test(buf, 255, 325350515UL); -        Test(buf, 254, 2920741773UL); -        Test(buf, 253, 3586628615UL); -    } - -private: -    inline void Test(const void* data, size_t len, ui32 expected) { -        const ui32 res = SuperFastHash(data, len); - -        try { -            UNIT_ASSERT_EQUAL(res, expected); -        } catch (...) { -            Cerr << res << ", " << expected << Endl; - -            throw; -        } -    } -}; - -UNIT_TEST_SUITE_REGISTRATION(TSfhTest); +  +class TSfhTest: public TTestBase {  +    UNIT_TEST_SUITE(TSfhTest);  +    UNIT_TEST(TestSfh)  +    UNIT_TEST_SUITE_END();  +  +private:  +    inline void TestSfh() {  +        ui8 buf[256];  +  +        for (size_t i = 0; i < 256; ++i) {  +            buf[i] = i;  +        }  +  +        Test(buf, 256, 3840866583UL);  +        Test(buf, 255, 325350515UL);  +        Test(buf, 254, 2920741773UL);  +        Test(buf, 253, 3586628615UL);  +    }  +  +private:  +    inline void Test(const void* data, size_t len, ui32 expected) {  +        const ui32 res = SuperFastHash(data, len);  +  +        try {  +            UNIT_ASSERT_EQUAL(res, expected);  +        } catch (...) {  +            Cerr << res << ", " << expected << Endl;  +  +            throw;  +        }  +    }  +};  +  +UNIT_TEST_SUITE_REGISTRATION(TSfhTest);  diff --git a/library/cpp/digest/sfh/ut/ya.make b/library/cpp/digest/sfh/ut/ya.make index 256a66295a4..73639cb3395 100644 --- a/library/cpp/digest/sfh/ut/ya.make +++ b/library/cpp/digest/sfh/ut/ya.make @@ -1,12 +1,12 @@  UNITTEST_FOR(library/cpp/digest/sfh) - +   OWNER(      pg      g:util  ) - -SRCS( -    sfh_ut.cpp -) - -END() +  +SRCS(  +    sfh_ut.cpp  +)  +  +END()  diff --git a/library/cpp/digest/sfh/ya.make b/library/cpp/digest/sfh/ya.make index b906cd15771..0424a5f3b80 100644 --- a/library/cpp/digest/sfh/ya.make +++ b/library/cpp/digest/sfh/ya.make @@ -1,12 +1,12 @@ -LIBRARY() - +LIBRARY()  +   OWNER(      pg      g:util  ) - -SRCS( -    sfh.cpp -) - -END() +  +SRCS(  +    sfh.cpp  +)  +  +END()   | 
