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/crc32c/crc32c.cpp | |
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/crc32c/crc32c.cpp')
-rw-r--r-- | library/cpp/digest/crc32c/crc32c.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/digest/crc32c/crc32c.cpp b/library/cpp/digest/crc32c/crc32c.cpp index 63daa12859..369b46a213 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); +} -ui32 Crc32c(const void* p, size_t size) noexcept { - return Singleton<TCrcUtilSse4>()->Extend(0, p, size); +bool HaveFastCrc32c() noexcept { + return TCrc::IsSSE42Available(); } - -ui32 Crc32cExtend(ui32 init, const void* data, size_t n) noexcept { - return Singleton<TCrcUtilSse4>()->Extend(init, data, n); -} - -bool HaveFastCrc32c() noexcept { - return TCrc::IsSSE42Available(); -} |