diff options
author | Ivan Blinkov <ivan@blinkov.ru> | 2022-02-10 16:47:11 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:11 +0300 |
commit | 5b283123c882433dafbaf6b338adeea16c1a0ea0 (patch) | |
tree | 339adc63bce23800021202ae4a8328a843dc447a /library/cpp/regex/hyperscan | |
parent | 1aeb9a455974457866f78722ad98114bafc84e8a (diff) | |
download | ydb-5b283123c882433dafbaf6b338adeea16c1a0ea0.tar.gz |
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/regex/hyperscan')
-rw-r--r-- | library/cpp/regex/hyperscan/hyperscan.cpp | 26 | ||||
-rw-r--r-- | library/cpp/regex/hyperscan/hyperscan.h | 14 | ||||
-rw-r--r-- | library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp | 4 |
3 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/regex/hyperscan/hyperscan.cpp b/library/cpp/regex/hyperscan/hyperscan.cpp index 8ef09665d0..ba321f9c29 100644 --- a/library/cpp/regex/hyperscan/hyperscan.cpp +++ b/library/cpp/regex/hyperscan/hyperscan.cpp @@ -8,27 +8,27 @@ #include <contrib/libs/hyperscan/runtime_avx2/hs_runtime.h> #include <contrib/libs/hyperscan/runtime_avx512/hs_common.h> #include <contrib/libs/hyperscan/runtime_avx512/hs_runtime.h> - -#include <util/generic/singleton.h> - + +#include <util/generic/singleton.h> + namespace NHyperscan { using TSerializedDatabase = THolder<char, TDeleter<decltype(&free), &free>>; using TCompileError = THolder<hs_compile_error_t, TDeleter<decltype(&hs_free_compile_error), &hs_free_compile_error>>; - namespace NPrivate { + namespace NPrivate { ERuntime DetectCurrentRuntime() { - if (NX86::HaveAVX512F() && NX86::HaveAVX512BW()) { + if (NX86::HaveAVX512F() && NX86::HaveAVX512BW()) { return ERuntime::AVX512; - } else if (NX86::HaveAVX() && NX86::HaveAVX2()) { + } else if (NX86::HaveAVX() && NX86::HaveAVX2()) { return ERuntime::AVX2; - } else if (NX86::HaveSSE42() && NX86::HavePOPCNT()) { + } else if (NX86::HaveSSE42() && NX86::HavePOPCNT()) { return ERuntime::Corei7; - } else { + } else { return ERuntime::Core2; - } - } - + } + } + TCPUFeatures RuntimeCpuFeatures(ERuntime runtime) { switch (runtime) { default: @@ -252,7 +252,7 @@ namespace NHyperscan { TString Serialize(const TDatabase& db) { char* databaseBytes = nullptr; size_t databaseLength; - hs_error_t status = Singleton<NPrivate::TImpl>()->SerializeDatabase( + hs_error_t status = Singleton<NPrivate::TImpl>()->SerializeDatabase( db.Get(), &databaseBytes, &databaseLength); @@ -265,7 +265,7 @@ namespace NHyperscan { TDatabase Deserialize(const TStringBuf& serialization) { hs_database_t* rawDb = nullptr; - hs_error_t status = Singleton<NPrivate::TImpl>()->DeserializeDatabase( + hs_error_t status = Singleton<NPrivate::TImpl>()->DeserializeDatabase( serialization.begin(), serialization.size(), &rawDb); diff --git a/library/cpp/regex/hyperscan/hyperscan.h b/library/cpp/regex/hyperscan/hyperscan.h index 8256155f57..1c8f404389 100644 --- a/library/cpp/regex/hyperscan/hyperscan.h +++ b/library/cpp/regex/hyperscan/hyperscan.h @@ -6,7 +6,7 @@ #include <util/generic/strbuf.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> -#include <util/system/cpu_id.h> +#include <util/system/cpu_id.h> namespace NHyperscan { using TCPUFeatures = decltype(hs_platform_info_t::cpu_features); @@ -30,7 +30,7 @@ namespace NHyperscan { }; - namespace NPrivate { + namespace NPrivate { enum class ERuntime { Core2 = 0, Corei7 = 1, @@ -44,9 +44,9 @@ namespace NHyperscan { hs_platform_info_t MakePlatformInfo(TCPUFeatures cpuFeatures); - struct TImpl { + struct TImpl { hs_error_t (*AllocScratch)(const hs_database_t* db, hs_scratch_t** scratch); - + hs_error_t (*Scan)(const hs_database_t* db, const char* data, unsigned length, unsigned flags, hs_scratch_t* scratch, match_event_handler onEvent, void* userCtx); @@ -58,7 +58,7 @@ namespace NHyperscan { TImpl() : TImpl(DetectCurrentRuntime()) {} explicit TImpl(ERuntime runtime); - }; + }; TDatabase Compile(const TStringBuf& regex, unsigned int flags, hs_platform_info_t* platform); @@ -114,8 +114,8 @@ namespace NHyperscan { const TScratch& scratch, const TStringBuf& text, const TImpl& impl); - } - + } + TDatabase Compile(const TStringBuf& regex, unsigned int flags); TDatabase Compile(const TStringBuf& regex, unsigned int flags, TCPUFeatures cpuFeatures); diff --git a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp index 89e7fe6b7a..9caa53f2e7 100644 --- a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp +++ b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp @@ -16,7 +16,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) { TScratch scratch = MakeScratch(db); unsigned int foundId = 42; - auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) { + auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) { foundId = id; }; NHyperscan::Scan( @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) { UNIT_ASSERT(!NHyperscan::Matches(db, scratch, "FOO")); TSet<unsigned int> foundIds; - auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) { + auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) { foundIds.insert(id); }; NHyperscan::Scan( |