diff --git a/mph b/mph index 03ff59e..835b23c 100644 --- a/mph +++ b/mph @@ -595,7 +595,14 @@ namespace mph::inline v5_0_5 { #pragma once #pragma GCC system_header -#if __has_include() +#include + +#ifndef MPH_EXPERIMENTAL_SIMD +#define MPH_EXPERIMENTAL_SIMD 0 +#endif + +#if __GLIBCXX__ && __has_include() +#define MPH_EXPERIMENTAL_SIMD 1 #include #endif @@ -1114,7 +1121,7 @@ struct find$pext { utility::array lut{}; }; -#if __has_include() +#if MPH_EXPERIMENTAL_SIMD template struct find$simd { using key_type = typename detail::traits::key_type; @@ -1180,7 +1187,7 @@ template inline constexpr auto lookup = template inline constexpr auto find = [] requires (probability >= 0u and probability <= 100u) - #if not __has_include() + #if not MPH_EXPERIMENTAL_SIMD and (entries.size() <= 64u) #endif ([[maybe_unused]] const auto& key, [[maybe_unused]] const auto&... ts) { @@ -1197,7 +1204,7 @@ template inline constexpr auto find = return type_traits::constant_t>::value.template operator()(key, ts...); } - #if __has_include() + #if MPH_EXPERIMENTAL_SIMD else { constexpr auto bucket_size = std::experimental::simd_size_v>; return type_traits::constant_t>::value.template @@ -1208,6 +1215,9 @@ template inline constexpr auto find = } // namespace mph #ifndef NTEST + +#include + static_assert(([] { constexpr auto expect = [](bool cond) { if (not cond) { void failed(); failed(); } };