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

Construct masks from boolean values, generators, bitsets, integers, and other masks. More...

Functions

constexpr xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask (std::same_as< value_type > auto b) noexcept
 Build a mask from a boolean value.
template<std::unsigned_integral T>
requires (!std::same_as<T, value_type>)
constexpr xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask (T m) noexcept
 Build a mask from the bits of an unsigned integral value. Each mask element is initialized from the corresponding input bit. Elements beyond the width of the input value are initialized to false.
template<std::size_t _UBytes, typename _UAbi>
requires (basic_mask<_UBytes, _UAbi>::size() == size())
constexpr xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask (const basic_mask< _UBytes, _UAbi > &m)
 Convert a mask with the same number of elements. Each output element retains the corresponding input boolean value.
constexpr xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask (std::invocable< std::integral_constant< simd_size_type, 0 > > auto fn)
 Generate each mask element from its index.
template<std::same_as< std::bitset< size()> > T>
constexpr xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask (const T &b) noexcept
 Construct a mask from the corresponding bitset.

Detailed Description

Construct masks from boolean values, generators, bitsets, integers, and other masks.

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

Function Documentation

◆ basic_mask() [1/5]

template<std::size_t _Bytes, typename _Abi>
template<std::size_t _UBytes, typename _UAbi>
requires (basic_mask<_UBytes, _UAbi>::size() == size())
xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask ( const basic_mask< _UBytes, _UAbi > & m)
inlineexplicitconstexpr

Convert a mask with the same number of elements. Each output element retains the corresponding input boolean value.

Template Parameters
_UBytesThe source mask's associated vector element size in bytes.
_UAbiThe source mask ABI.
Parameters
mThe mask to convert.

◆ basic_mask() [2/5]

template<std::size_t _Bytes, typename _Abi>
template<std::same_as< std::bitset< size()> > T>
xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask ( const T & b)
inlineconstexprnoexcept

Construct a mask from the corresponding bitset.

Parameters
bThe bitset supplying the value of each mask element.

◆ basic_mask() [3/5]

template<std::size_t _Bytes, typename _Abi>
xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask ( std::invocable< std::integral_constant< simd_size_type, 0 > > auto fn)
inlineconstexpr

Generate each mask element from its index.

Parameters
fnThe generator returning a boolean value for each element index.

◆ basic_mask() [4/5]

template<std::size_t _Bytes, typename _Abi>
xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask ( std::same_as< value_type > auto b)
inlineexplicitconstexprnoexcept

Build a mask from a boolean value.

Parameters
bThe boolean value to broadcast to all mask elements.

◆ basic_mask() [5/5]

template<std::size_t _Bytes, typename _Abi>
template<std::unsigned_integral T>
requires (!std::same_as<T, value_type>)
xvec::simd::basic_mask< _Bytes, _Abi >::basic_mask ( T m)
inlineexplicitconstexprnoexcept

Build a mask from the bits of an unsigned integral value. Each mask element is initialized from the corresponding input bit. Elements beyond the width of the input value are initialized to false.

Parameters
mThe unsigned integral value supplying the bits.