Intel xvec
Experimental C++ simd class library
Loading...
Searching...
No Matches
C++26: Mask reductions

Query mask elements, count selected elements, and find their indexes. More...

Functions

constexpr bool xvec::simd::all_of (const mask_type auto &mask) noexcept
 Return true if every mask element is true.
constexpr bool xvec::simd::all_of (std::same_as< bool > auto b) noexcept
 Apply all_of to one boolean element.
constexpr bool xvec::simd::any_of (const mask_type auto &mask) noexcept
 Return true if any mask element is true.
constexpr bool xvec::simd::any_of (std::same_as< bool > auto b) noexcept
 Apply any_of to one boolean element.
constexpr bool xvec::simd::none_of (const mask_type auto &mask) noexcept
 Return true if no mask element is true.
constexpr bool xvec::simd::none_of (std::same_as< bool > auto b) noexcept
 Apply none_of to one boolean element.
constexpr simd_size_type xvec::simd::reduce_count (const mask_type auto &mask) noexcept
 Count the true mask elements.
constexpr simd_size_type xvec::simd::reduce_count (std::same_as< bool > auto b) noexcept
 Count one boolean element.
constexpr simd_size_type xvec::simd::reduce_min_index (const mask_type auto &mask) noexcept
 Return the index of the first true mask element.
constexpr simd_size_type xvec::simd::reduce_min_index (std::same_as< bool > auto) noexcept
 Apply reduce_min_index to one boolean element.
constexpr simd_size_type xvec::simd::reduce_max_index (const mask_type auto &mask) noexcept
 Return the index of the last true mask element.
constexpr simd_size_type xvec::simd::reduce_max_index (std::same_as< bool > auto) noexcept
 Apply reduce_max_index to one boolean element.

Detailed Description

Query mask elements, count selected elements, and find their indexes.

See also
https://eel.is/c++draft/simd.mask.reductions

Function Documentation

◆ all_of() [1/2]

bool xvec::simd::all_of ( const mask_type auto & mask)
constexprnoexcept

Return true if every mask element is true.

Parameters
maskThe mask to query.
Returns
True if all elements are true.

◆ all_of() [2/2]

bool xvec::simd::all_of ( std::same_as< bool > auto b)
constexprnoexcept

Apply all_of to one boolean element.

Parameters
bThe boolean element.
Returns
b.

◆ any_of() [1/2]

bool xvec::simd::any_of ( const mask_type auto & mask)
constexprnoexcept

Return true if any mask element is true.

Parameters
maskThe mask to query.
Returns
True if at least one element is true.

◆ any_of() [2/2]

bool xvec::simd::any_of ( std::same_as< bool > auto b)
constexprnoexcept

Apply any_of to one boolean element.

Parameters
bThe boolean element.
Returns
b.

◆ none_of() [1/2]

bool xvec::simd::none_of ( const mask_type auto & mask)
constexprnoexcept

Return true if no mask element is true.

Parameters
maskThe mask to query.
Returns
True if all elements are false.

◆ none_of() [2/2]

bool xvec::simd::none_of ( std::same_as< bool > auto b)
constexprnoexcept

Apply none_of to one boolean element.

Parameters
bThe boolean element.
Returns
!b.

◆ reduce_count() [1/2]

simd_size_type xvec::simd::reduce_count ( const mask_type auto & mask)
constexprnoexcept

Count the true mask elements.

Parameters
maskThe mask to query.
Returns
The number of true elements.

◆ reduce_count() [2/2]

simd_size_type xvec::simd::reduce_count ( std::same_as< bool > auto b)
constexprnoexcept

Count one boolean element.

Parameters
bThe boolean element.
Returns
1 if b is true, or 0 otherwise.

◆ reduce_max_index() [1/2]

simd_size_type xvec::simd::reduce_max_index ( const mask_type auto & mask)
constexprnoexcept

Return the index of the last true mask element.

Parameters
maskThe mask to query.
Precondition
At least one mask element is true.
Returns
The highest selected index.

◆ reduce_max_index() [2/2]

simd_size_type xvec::simd::reduce_max_index ( std::same_as< bool > auto)
constexprnoexcept

Apply reduce_max_index to one boolean element.

Precondition
The input is true.
Returns
0.

◆ reduce_min_index() [1/2]

simd_size_type xvec::simd::reduce_min_index ( const mask_type auto & mask)
constexprnoexcept

Return the index of the first true mask element.

Parameters
maskThe mask to query.
Precondition
At least one mask element is true.
Returns
The lowest selected index.

◆ reduce_min_index() [2/2]

simd_size_type xvec::simd::reduce_min_index ( std::same_as< bool > auto)
constexprnoexcept

Apply reduce_min_index to one boolean element.

Precondition
The input is true.
Returns
0.