mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 15:26:19 -04:00
chore: check for availability of boyer_moore_horspool_searcher
This commit is contained in:
parent
7b3e718cda
commit
63dff242d4
@ -28,6 +28,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <version>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
@ -94,9 +95,12 @@ class filesystem_parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto ss = mm.span<char>(start);
|
auto ss = mm.span<char>(start);
|
||||||
auto it = std::search(
|
#if __cpp_lib_boyer_moore_searcher >= 201603
|
||||||
ss.begin(), ss.end(),
|
auto searcher = std::boyer_moore_searcher(magic.begin(), magic.end());
|
||||||
std::boyer_moore_horspool_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()) {
|
if (it == ss.end()) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user