Saturating arithmetic and element conversion for integral vectors.
More...
|
| template<vec_integral _Vp> |
| constexpr _Vp | xvec::simd::saturating_add (const _Vp &lhs, const _Vp &rhs) noexcept |
| | Compute the saturated addition of each respective pair of SIMD elements.
|
| template<vec_integral _Vp> |
| constexpr _Vp | xvec::simd::saturating_sub (const _Vp &lhs, const _Vp &rhs) noexcept |
| | Compute the saturated subtraction of each respective pair of SIMD elements.
|
| template<vec_integral _Vp> |
| constexpr _Vp | xvec::simd::saturating_mul (const _Vp &lhs, const _Vp &rhs) noexcept |
| | Compute the saturated multiplication of each respective pair of SIMD elements.
|
| template<vec_integral _Vp> |
| constexpr _Vp | xvec::simd::saturating_div (const _Vp &lhs, const _Vp &rhs) noexcept |
| | Compute the saturated division of each respective pair of SIMD elements.
|
| template<std::integral _Up, vec_integral _Vp> |
| constexpr rebind_t< _Up, _Vp > | xvec::simd::saturating_cast (const _Vp &v) noexcept |
| | Compute a basic_vec where every element is converted to the new type, or if the value can't be represented then the largest or smallest value of that type is used instead, whichever is closer to the original value.
|
Saturating arithmetic and element conversion for integral vectors.
Proposed in P2956, "Add saturating library support to std::simd".
- See also
- https://wg21.link/P2956
◆ saturating_add()
template<vec_integral _Vp>
| _Vp xvec::simd::saturating_add |
( |
const _Vp & | lhs, |
|
|
const _Vp & | rhs ) |
|
constexprnoexcept |
Compute the saturated addition of each respective pair of SIMD elements.
- Template Parameters
-
- Parameters
-
- Returns
- A basic_vec containing the saturated element-wise sums.
◆ saturating_cast()
template<std::integral _Up, vec_integral _Vp>
| rebind_t< _Up, _Vp > xvec::simd::saturating_cast |
( |
const _Vp & | v | ) |
|
|
constexprnoexcept |
Compute a basic_vec where every element is converted to the new type, or if the value can't be represented then the largest or smallest value of that type is used instead, whichever is closer to the original value.
- Template Parameters
-
| _Up | The target integral element type. |
| _Vp | The integral basic_vec type. |
- Parameters
-
- Returns
- A basic_vec value in which each element is the saturating cast of the respective input value.
◆ saturating_div()
template<vec_integral _Vp>
| _Vp xvec::simd::saturating_div |
( |
const _Vp & | lhs, |
|
|
const _Vp & | rhs ) |
|
constexprnoexcept |
Compute the saturated division of each respective pair of SIMD elements.
- Template Parameters
-
- Parameters
-
- Returns
- A basic_vec containing the saturated element-wise quotients.
◆ saturating_mul()
template<vec_integral _Vp>
| _Vp xvec::simd::saturating_mul |
( |
const _Vp & | lhs, |
|
|
const _Vp & | rhs ) |
|
constexprnoexcept |
Compute the saturated multiplication of each respective pair of SIMD elements.
- Template Parameters
-
- Parameters
-
- Returns
- A basic_vec containing the saturated element-wise products.
◆ saturating_sub()
template<vec_integral _Vp>
| _Vp xvec::simd::saturating_sub |
( |
const _Vp & | lhs, |
|
|
const _Vp & | rhs ) |
|
constexprnoexcept |
Compute the saturated subtraction of each respective pair of SIMD elements.
- Template Parameters
-
- Parameters
-
- Returns
- A basic_vec containing the saturated element-wise differences.