Intel xvec
Experimental C++ simd class library
Loading...
Searching...
No Matches
Create mask from count

Create a mask with a specified number of leading true elements. More...

Functions

template<typename _Vp>
constexpr auto xvec::simd::mask_from_count (simd_size_type n) noexcept
 Generate a mask with its first n elements set to true.

Detailed Description

Create a mask with a specified number of leading true elements.

Proposed in P3440 for uses such as handling loop remainders.

See also
https://wg21.link/P3440

Function Documentation

◆ mask_from_count()

template<typename _Vp>
auto xvec::simd::mask_from_count ( simd_size_type n)
constexprnoexcept

Generate a mask with its first n elements set to true.

Template Parameters
_VpThe vector type whose mask is returned, or a scalar type for a boolean result.
Parameters
nThe number of elements to set. Counts larger than the mask width set every element.
Returns
A prefix mask for vector types, or n > 0 for scalar types.