diff --git a/include/libhat/Scanner.hpp b/include/libhat/Scanner.hpp index 4ef9f1a..93bccab 100644 --- a/include/libhat/Scanner.hpp +++ b/include/libhat/Scanner.hpp @@ -52,12 +52,15 @@ namespace hat { namespace detail { enum class scan_mode { - Auto, - Search, - FastFirst, - AVX2, - AVX512, - Neon + Auto, // Automatically choose the mode to use + Search, // std::search + FastFirst, // std::find + std::equal + AVX2, // x86 AVX2 + AVX512, // x86 AVX512 + Neon, // ARM Neon + + // Fallback mode to use for SIMD remaining bytes + Single = FastFirst }; template @@ -121,7 +124,7 @@ namespace hat { signature_view signature ) { if LIBHAT_IF_CONSTEVAL { - return detail::find_pattern(begin, end, signature); + return detail::find_pattern(begin, end, signature); } else { return detail::find_pattern(begin, end, signature); } diff --git a/src/Scanner.cpp b/src/Scanner.cpp index 1e5a5e0..e040363 100644 --- a/src/Scanner.cpp +++ b/src/Scanner.cpp @@ -121,6 +121,6 @@ namespace hat::detail { } #endif // If none of the vectorized implementations are available/supported, then fallback to scanning per-byte - return find_pattern(begin, end, signature); + return find_pattern(begin, end, signature); } } diff --git a/src/arch/arm/Neon.cpp b/src/arch/arm/Neon.cpp index 659ca23..3110ce8 100644 --- a/src/arch/arm/Neon.cpp +++ b/src/arch/arm/Neon.cpp @@ -22,7 +22,7 @@ namespace hat::detail { } } - return find_pattern(begin, end, signature); + return find_pattern(begin, end, signature); } } #endif diff --git a/src/arch/x86/AVX2.cpp b/src/arch/x86/AVX2.cpp index 2e9ad8f..ba9be1e 100644 --- a/src/arch/x86/AVX2.cpp +++ b/src/arch/x86/AVX2.cpp @@ -48,7 +48,7 @@ namespace hat::detail { // Look in remaining bytes that couldn't be grouped into 256 bits begin = reinterpret_cast(vec); - return find_pattern(begin, end, signature); + return find_pattern(begin, end, signature); } } #endif diff --git a/src/arch/x86/AVX512.cpp b/src/arch/x86/AVX512.cpp index b099a26..c4fe2e0 100644 --- a/src/arch/x86/AVX512.cpp +++ b/src/arch/x86/AVX512.cpp @@ -45,7 +45,7 @@ namespace hat::detail { // Look in remaining bytes that couldn't be grouped into 512 bits begin = reinterpret_cast(vec); - return find_pattern(begin, end, signature); + return find_pattern(begin, end, signature); } } #endif