diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/digest/crc32c | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/crc32c')
-rw-r--r-- | library/cpp/digest/crc32c/crc32c.cpp | 54 | ||||
-rw-r--r-- | library/cpp/digest/crc32c/crc32c.h | 10 | ||||
-rw-r--r-- | library/cpp/digest/crc32c/crc32c_ut.cpp | 18 | ||||
-rw-r--r-- | library/cpp/digest/crc32c/ut/ya.make | 16 | ||||
-rw-r--r-- | library/cpp/digest/crc32c/ya.make | 16 |
5 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/digest/crc32c/crc32c.cpp b/library/cpp/digest/crc32c/crc32c.cpp index 369b46a213..63daa12859 100644 --- a/library/cpp/digest/crc32c/crc32c.cpp +++ b/library/cpp/digest/crc32c/crc32c.cpp @@ -1,40 +1,40 @@ #include "crc32c.h" - + #include <util/generic/singleton.h> #include <contrib/libs/crcutil/interface.h> -namespace { - typedef crcutil_interface::CRC TCrc; - - struct TCrcUtilSse4 { - TCrc* const Pimpl; +namespace { + typedef crcutil_interface::CRC TCrc; + + struct TCrcUtilSse4 { + TCrc* const Pimpl; TCrcUtilSse4() noexcept - : Pimpl(TCrc::Create(0x82f63b78, 0, 32, true, 0, 0, 0, TCrc::IsSSE42Available(), nullptr)) - { - } + : Pimpl(TCrc::Create(0x82f63b78, 0, 32, true, 0, 0, 0, TCrc::IsSSE42Available(), nullptr)) + { + } - ~TCrcUtilSse4() noexcept { - Pimpl->Delete(); - } + ~TCrcUtilSse4() noexcept { + Pimpl->Delete(); + } inline ui32 Extend(ui32 init, const void* data, size_t n) const noexcept { - crcutil_interface::UINT64 sum = init; - Pimpl->Compute(data, n, &sum); - return (ui32)sum; - } + crcutil_interface::UINT64 sum = init; + Pimpl->Compute(data, n, &sum); + return (ui32)sum; + } }; -} - -ui32 Crc32c(const void* p, size_t size) noexcept { - return Singleton<TCrcUtilSse4>()->Extend(0, p, size); -} - -ui32 Crc32cExtend(ui32 init, const void* data, size_t n) noexcept { - return Singleton<TCrcUtilSse4>()->Extend(init, data, n); -} +} -bool HaveFastCrc32c() noexcept { - return TCrc::IsSSE42Available(); +ui32 Crc32c(const void* p, size_t size) noexcept { + return Singleton<TCrcUtilSse4>()->Extend(0, p, size); } + +ui32 Crc32cExtend(ui32 init, const void* data, size_t n) noexcept { + return Singleton<TCrcUtilSse4>()->Extend(init, data, n); +} + +bool HaveFastCrc32c() noexcept { + return TCrc::IsSSE42Available(); +} diff --git a/library/cpp/digest/crc32c/crc32c.h b/library/cpp/digest/crc32c/crc32c.h index 17b554c8e1..2f4b190b9c 100644 --- a/library/cpp/digest/crc32c/crc32c.h +++ b/library/cpp/digest/crc32c/crc32c.h @@ -1,9 +1,9 @@ #pragma once -#include <util/system/types.h> +#include <util/system/types.h> // Threadsafe -ui32 Crc32c(const void* p, size_t size) noexcept; -ui32 Crc32cExtend(ui32 init, const void* data, size_t n) noexcept; - -bool HaveFastCrc32c() noexcept; +ui32 Crc32c(const void* p, size_t size) noexcept; +ui32 Crc32cExtend(ui32 init, const void* data, size_t n) noexcept; + +bool HaveFastCrc32c() noexcept; diff --git a/library/cpp/digest/crc32c/crc32c_ut.cpp b/library/cpp/digest/crc32c/crc32c_ut.cpp index aa31b83422..08e7bbf120 100644 --- a/library/cpp/digest/crc32c/crc32c_ut.cpp +++ b/library/cpp/digest/crc32c/crc32c_ut.cpp @@ -1,12 +1,12 @@ -#include "crc32c.h" - +#include "crc32c.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TestCrc32c) { Y_UNIT_TEST(TestCalc) { - UNIT_ASSERT_VALUES_EQUAL(Crc32c("abc", 3), ui32(910901175)); - } - + UNIT_ASSERT_VALUES_EQUAL(Crc32c("abc", 3), ui32(910901175)); + } + Y_UNIT_TEST(TestUnaligned) { const TString str(1000, 'a'); for (size_t substrLen = 0; substrLen <= str.length(); ++substrLen) { @@ -18,6 +18,6 @@ Y_UNIT_TEST_SUITE(TestCrc32c) { } Y_UNIT_TEST(TestExtend) { - UNIT_ASSERT_VALUES_EQUAL(Crc32cExtend(1, "abc", 3), ui32(2466950601)); - } -} + UNIT_ASSERT_VALUES_EQUAL(Crc32cExtend(1, "abc", 3), ui32(2466950601)); + } +} diff --git a/library/cpp/digest/crc32c/ut/ya.make b/library/cpp/digest/crc32c/ut/ya.make index 325622e080..8ce179aaa8 100644 --- a/library/cpp/digest/crc32c/ut/ya.make +++ b/library/cpp/digest/crc32c/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/digest/crc32c) - -OWNER(pg) - -SRCS( - crc32c_ut.cpp -) - -END() + +OWNER(pg) + +SRCS( + crc32c_ut.cpp +) + +END() diff --git a/library/cpp/digest/crc32c/ya.make b/library/cpp/digest/crc32c/ya.make index d6faf16c9c..5d21e907a0 100644 --- a/library/cpp/digest/crc32c/ya.make +++ b/library/cpp/digest/crc32c/ya.make @@ -1,20 +1,20 @@ LIBRARY() -#!!! +#!!! OWNER( ddoarn a-romanov - pg - gulin - dcherednik + pg + gulin + dcherednik g:yamr g:rtmr ) -PEERDIR( - contrib/libs/crcutil -) - +PEERDIR( + contrib/libs/crcutil +) + SRCS( crc32c.cpp ) |