25#ifndef _GLIBCXX_SIMD_ALG_H
26#define _GLIBCXX_SIMD_ALG_H 1
29#pragma GCC system_header
32#if __cplusplus >= 202400L
37#pragma GCC diagnostic push
38#pragma GCC diagnostic ignored "-Wpsabi"
41namespace std _GLIBCXX_VISIBILITY(default)
43_GLIBCXX_BEGIN_NAMESPACE_VERSION
46 template<
typename _Tp,
typename _Ap>
47 [[__gnu__::__always_inline__]]
48 constexpr basic_vec<_Tp, _Ap>
49 min(
const basic_vec<_Tp, _Ap>& __a,
const basic_vec<_Tp, _Ap>& __b)
noexcept
50 {
return __select_impl(__a < __b, __a, __b); }
52 template<
typename _Tp,
typename _Ap>
53 [[__gnu__::__always_inline__]]
54 constexpr basic_vec<_Tp, _Ap>
55 max(
const basic_vec<_Tp, _Ap>& __a,
const basic_vec<_Tp, _Ap>& __b)
noexcept
56 {
return __select_impl(__a < __b, __b, __a); }
58 template<
typename _Tp,
typename _Ap>
59 [[__gnu__::__always_inline__]]
61 minmax(
const basic_vec<_Tp, _Ap>& __a,
const basic_vec<_Tp, _Ap>& __b)
noexcept
62 {
return {min(__a, __b), max(__a, __b)}; }
64 template<
typename _Tp,
typename _Ap>
65 [[__gnu__::__always_inline__]]
66 constexpr basic_vec<_Tp, _Ap>
67 clamp(
const basic_vec<_Tp, _Ap>& __v,
const basic_vec<_Tp, _Ap>& __lo,
68 const basic_vec<_Tp, _Ap>& __hi)
70 __glibcxx_simd_precondition(none_of(__lo > __hi),
"lower bound is larger than upper bound");
71 return max(__lo, min(__hi, __v));
74 template<
typename _Tp,
typename _Up>
76 select(
bool __c,
const _Tp& __a,
const _Up& __b)
77 -> remove_cvref_t<
decltype(__c ? __a : __b)>
78 {
return __c ? __a : __b; }
80 template<
size_t _Bytes,
typename _Ap,
typename _Tp,
typename _Up>
81 [[__gnu__::__always_inline__]]
83 select(
const basic_mask<_Bytes, _Ap>& __c,
const _Tp& __a,
const _Up& __b)
84 noexcept ->
decltype(__select_impl(__c, __a, __b))
85 {
return __select_impl(__c, __a, __b); }
93_GLIBCXX_END_NAMESPACE_VERSION
96#pragma GCC diagnostic pop
pair(_T1, _T2) -> pair< _T1, _T2 >
Two pairs are equal iff their members are equal.
ISO C++ entities toplevel namespace is std.