aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
commit31773f157bf8164364649b5f470f52dece0a4317 (patch)
tree33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h
parent2c7938962d8689e175574fc1e817c05049f27905 (diff)
parenteff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff)
downloadydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h
index 0dba345e05..847d006629 100644
--- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h
+++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h
@@ -19,6 +19,7 @@
#include <__type_traits/is_volatile.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
+#include <__utility/integer_sequence.h>
#include <cstdint>
#include <limits>
@@ -71,6 +72,25 @@ inline constexpr bool __can_broadcast_v =
(!__is_vectorizable_v<_Up> && is_convertible_v<_Up, _Tp>) || is_same_v<_Up, int> ||
(is_same_v<_Up, unsigned int> && is_unsigned_v<_Tp>);
+template <class _Tp, class _Generator, std::size_t _Idx, class = void>
+inline constexpr bool __is_well_formed = false;
+
+template <class _Tp, class _Generator, std::size_t _Idx>
+inline constexpr bool
+ __is_well_formed<_Tp,
+ _Generator,
+ _Idx,
+ std::void_t<decltype(std::declval<_Generator>()(integral_constant<size_t, _Idx>()))>> =
+ __can_broadcast_v<_Tp, decltype(std::declval<_Generator>()(integral_constant<size_t, _Idx>()))>;
+
+template <class _Tp, class _Generator, std::size_t... _Idxes>
+_LIBCPP_HIDE_FROM_ABI constexpr bool __can_generate(index_sequence<_Idxes...>) {
+ return (true && ... && __is_well_formed<_Tp, _Generator, _Idxes>);
+}
+
+template <class _Tp, class _Generator, std::size_t _Size>
+inline constexpr bool __can_generate_v = experimental::__can_generate<_Tp, _Generator>(make_index_sequence<_Size>());
+
} // namespace parallelism_v2
_LIBCPP_END_NAMESPACE_EXPERIMENTAL