T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
Initialization

Description

Functions for initializing Vec's.

Functions

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::int2bits (const uint64_t a)
 Sets all bits of each element of a Vec to the corresponding bit of an integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::int2msb (const uint64_t a)
 Sets the most significant bit of each element of a Vec to the corresponding bit of an integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::iota ()
 Creates a Vec with sequentially increasing numbers, starting with 0.
 
template<typename T , size_t SIMD_WIDTH>
static uint64_t simd::msb2int (const Vec< T, SIMD_WIDTH > &a)
 Collects the most significant bit of each element of a Vec into an integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::set1 (const dont_deduce< T > a)
 Returns a Vec with all elements set to the same value.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setmax ()
 Sets all elements of a Vec to the maximum value of the element type.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setmin ()
 Sets all elements of a Vec to the minimum value of the element type.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setnegunity ()
 Sets all elements of a Vec to the value -1.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setones ()
 Sets all bits of a Vec to 1.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setunity ()
 Sets all elements of a Vec to the value 1.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setzero ()
 Returns a Vec with all elements set to zero.
 

Function Documentation

◆ int2bits()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::int2bits ( const uint64_t a)
inlinestatic

Sets all bits of each element of a Vec to the corresponding bit of an integer.

The bottom n bits of the input integer are used, where n is the number of elements in the Vec. All other bits of the input are ignored.

Parameters
ainteger
Returns
Vec with all bits of each element set to the corresponding bit of the input integer

◆ int2msb()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::int2msb ( const uint64_t a)
inlinestatic

Sets the most significant bit of each element of a Vec to the corresponding bit of an integer.

The bottom n bits of the input integer are used, where n is the number of elements in the Vec. All other bits of the input are ignored.

All other bits of the output elements are set to zero.

Parameters
ainteger
Returns
Vec with the most significant bit of each element set to the corresponding bit of the input integer

◆ iota()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::iota ( )
inlinestatic

Creates a Vec with sequentially increasing numbers, starting with 0.

The sequence starts from the lowest element of the Vec, i.e. the lowest element of the Vec is set to 0, the next element to 1, and so on.

Returns
Vec containing sequentially increasing numbers

◆ msb2int()

template<typename T , size_t SIMD_WIDTH>
static uint64_t simd::msb2int ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Collects the most significant bit of each element of a Vec into an integer.

Parameters
aVec
Returns
an integer containing the most significant bit of each element of the input Vec padded with zeros to 64 bits

◆ set1()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::set1 ( const dont_deduce< T > a)
inlinestatic

Returns a Vec with all elements set to the same value.

Note
The template parameter T has to be explicitly specified and is not deduced from the argument in order to avoid confusion with creating a Vec with an unintended type from an immediate value.
Parameters
avalue to set all elements to
Returns
Vec with all elements set to the same value

◆ setmax()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setmax ( )
inlinestatic

Sets all elements of a Vec to the maximum value of the element type.

Returns
Vec with all elements set to the maximum value of the element type

◆ setmin()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setmin ( )
inlinestatic

Sets all elements of a Vec to the minimum value of the element type.

Returns
Vec with all elements set to the minimum value of the element type

◆ setnegunity()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setnegunity ( )
inlinestatic

Sets all elements of a Vec to the value -1.

Only available for signed integer and floating point types.

Returns
Vec with all elements set to the value -1

◆ setones()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setones ( )
inlinestatic

Sets all bits of a Vec to 1.

Returns
Vec with all bits set to 1

◆ setunity()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setunity ( )
inlinestatic

Sets all elements of a Vec to the value 1.

Returns
Vec with all elements set to the value 1

◆ setzero()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::setzero ( )
inlinestatic

Returns a Vec with all elements set to zero.

Returns
Vec with all elements set to zero