From 63dff242d422cf54398285e7d953a3852e7f1d05 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Tue, 23 Jan 2024 15:06:34 +0100 Subject: [PATCH] chore: check for availability of boyer_moore_horspool_searcher --- src/dwarfs/filesystem_v2.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dwarfs/filesystem_v2.cpp b/src/dwarfs/filesystem_v2.cpp index fa88841a..ae85e1a2 100644 --- a/src/dwarfs/filesystem_v2.cpp +++ b/src/dwarfs/filesystem_v2.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -94,9 +95,12 @@ class filesystem_parser { } auto ss = mm.span(start); - auto it = std::search( - ss.begin(), ss.end(), - std::boyer_moore_horspool_searcher(magic.begin(), magic.end())); +#if __cpp_lib_boyer_moore_searcher >= 201603 + auto searcher = std::boyer_moore_searcher(magic.begin(), magic.end()); +#else + auto searcher = std::default_searcher(magic.begin(), magic.end()); +#endif + auto it = std::search(ss.begin(), ss.end(), searcher); if (it == ss.end()) { break;