11#include <xvec/detail/config.hpp>
16namespace _XVEC_NAMESPACE::simd
33requires std::totally_ordered<typename _Vp::value_type>
34constexpr _Vp
min(
const _Vp& lhs,
const _Vp& rhs)
noexcept {
36 return _Vp([=](
auto i) {
using std::min;
return min(lhs[i], rhs[i]); });
38 return detail::minimum(target, lhs, rhs);
47requires std::totally_ordered<typename _Vp::value_type>
48constexpr _Vp
max(
const _Vp& lhs,
const _Vp& rhs)
noexcept {
50 return _Vp([=](
auto i) {
using std::max;
return max(lhs[i], rhs[i]); });
52 return detail::maximum(target, lhs, rhs);
61template<vec_totally_ordered _Vp>
62requires std::totally_ordered<typename _Vp::value_type>
63constexpr std::pair<_Vp, _Vp>
64minmax(
const _Vp& lhs,
const _Vp& rhs)
noexcept {
return std::make_pair(
min(lhs, rhs),
max(lhs, rhs)); }
74template<vec_totally_ordered _Vp>
75requires std::totally_ordered<typename _Vp::value_type>
77clamp(
const _Vp& values,
const _Vp& low,
const _Vp& high) {
return min(
max(values, low), high); }
87template<mask_type _M,
class _T,
class _U>
88constexpr auto select(
const _M& m,
const _T& if_true,
const _U& if_false)
noexcept ->
decltype(simd_select_impl(m, if_true, if_false))
89 {
return simd_select_impl(m, if_true, if_false); }
98template<std::copyable _Tp, std::copyable _Up>
99constexpr auto select(
bool c,
const _Tp& a,
const _Up& b) -> std::remove_cvref_t<
decltype(c ? a : b)> {
return c ? a : b; }
constexpr _Vp clamp(const _Vp &values, const _Vp &low, const _Vp &high)
Clamp the input values to be contained within the range [low,high]. If a value is less than low it wi...
Definition std_algorithm.hpp:77
constexpr _Vp min(const _Vp &lhs, const _Vp &rhs) noexcept
Compute the smaller of each respective vec element from the two input arguments.
Definition std_algorithm.hpp:34
constexpr _Vp max(const _Vp &lhs, const _Vp &rhs) noexcept
Compute the larger of each respective vec element from the two input arguments.
Definition std_algorithm.hpp:48
constexpr std::pair< _Vp, _Vp > minmax(const _Vp &lhs, const _Vp &rhs) noexcept
Compute a pair of vec values giving the smaller and larger respective of each corresponding vec eleme...
Definition std_algorithm.hpp:64
constexpr auto select(const _M &m, const _T &if_true, const _U &if_false) noexcept -> decltype(simd_select_impl(m, if_true, if_false))
Select between corresponding elements according to a mask.
Definition std_algorithm.hpp:88