Tuesday
Classes | Macros | Typedefs | Functions
<tue/simd.hpp>

Detailed Description

The simd class template and its associated utility structs and functions.

Classes

struct  tue::is_simd_component< T >
 Checks if a type can be used as the component type of an SIMD vector. More...
 
struct  tue::is_arithmetic_simd_component< T >
 Checks if a type is an arithmetic type that can be used as the component type of an SIMD vector. More...
 
struct  tue::is_floating_point_simd_component< T >
 Checks if a type is a floating-point type that can be used as the component type of an SIMD vector. More...
 
struct  tue::is_integral_simd_component< T >
 Checks if a type is an integral type that can be used as the component type of an SIMD vector. More...
 
class  tue::simd< T, N >
 An N-component SIMD vector. More...
 

Macros

#define TUE_SSE
 Defined if the current compiler configuration supports SSE intrinsics. More...
 
#define TUE_SSE2
 Defined if the current compiler configuration supports SSE2 intrinsics. More...
 

Typedefs

template<typename T >
using tue::simd2 = simd< T, 2 >
 A 2-component SIMD vector. More...
 
template<typename T >
using tue::simd4 = simd< T, 4 >
 A 4-component SIMD vector. More...
 
template<typename T >
using tue::simd8 = simd< T, 8 >
 An 8-component SIMD vector. More...
 
template<typename T >
using tue::simd16 = simd< T, 16 >
 A 16-component SIMD vector. More...
 
template<typename T >
using tue::simd32 = simd< T, 32 >
 A 32-component SIMD vector. More...
 
template<typename T >
using tue::simd64 = simd< T, 64 >
 A 64-component SIMD vector. More...
 
using tue::float32x2 = simd2< float >
 A 2-component SIMD vector with float components. More...
 
using tue::float32x4 = simd4< float >
 A 4-component SIMD vector with float components. More...
 
using tue::float32x8 = simd8< float >
 An 8-component SIMD vector with float components. More...
 
using tue::float32x16 = simd16< float >
 A 16-component SIMD vector with float components. More...
 
using tue::float64x2 = simd2< double >
 A 2-component SIMD vector with double components. More...
 
using tue::float64x4 = simd4< double >
 A 4-component SIMD vector with double components. More...
 
using tue::float64x8 = simd8< double >
 An 8-component SIMD vector with double components. More...
 
using tue::int8x2 = simd2< std::int8_t >
 A 2-component SIMD vector with std::int8_t components. More...
 
using tue::int8x4 = simd4< std::int8_t >
 A 4-component SIMD vector with std::int8_t components. More...
 
using tue::int8x8 = simd8< std::int8_t >
 An 8-component SIMD vector with std::int8_t components. More...
 
using tue::int8x16 = simd16< std::int8_t >
 A 16-component SIMD vector with std::int8_t components. More...
 
using tue::int8x32 = simd32< std::int8_t >
 A 32-component SIMD vector with std::int8_t components. More...
 
using tue::int8x64 = simd64< std::int8_t >
 A 64-component SIMD vector with std::int8_t components. More...
 
using tue::int16x2 = simd2< std::int16_t >
 A 2-component SIMD vector with std::int16_t components. More...
 
using tue::int16x4 = simd4< std::int16_t >
 A 4-component SIMD vector with std::int16_t components. More...
 
using tue::int16x8 = simd8< std::int16_t >
 An 8-component SIMD vector with std::int16_t components. More...
 
using tue::int16x16 = simd16< std::int16_t >
 A 16-component SIMD vector with std::int16_t components. More...
 
using tue::int16x32 = simd32< std::int16_t >
 A 32-component SIMD vector with std::int16_t components. More...
 
using tue::int32x2 = simd2< std::int32_t >
 A 2-component SIMD vector with std::int32_t components. More...
 
using tue::int32x4 = simd4< std::int32_t >
 A 4-component SIMD vector with std::int32_t components. More...
 
using tue::int32x8 = simd8< std::int32_t >
 An 8-component SIMD vector with std::int32_t components. More...
 
using tue::int32x16 = simd16< std::int32_t >
 A 16-component SIMD vector with std::int32_t components. More...
 
using tue::int64x2 = simd2< std::int64_t >
 A 2-component SIMD vector with std::int64_t components. More...
 
using tue::int64x4 = simd4< std::int64_t >
 A 4-component SIMD vector with std::int64_t components. More...
 
using tue::int64x8 = simd8< std::int64_t >
 An 8-component SIMD vector with std::int64_t components. More...
 
using tue::uint8x2 = simd2< std::uint8_t >
 A 2-component SIMD vector with std::uint8_t components. More...
 
using tue::uint8x4 = simd4< std::uint8_t >
 A 4-component SIMD vector with std::uint8_t components. More...
 
using tue::uint8x8 = simd8< std::uint8_t >
 An 8-component SIMD vector with std::uint8_t components. More...
 
using tue::uint8x16 = simd16< std::uint8_t >
 A 16-component SIMD vector with std::uint8_t components. More...
 
using tue::uint8x32 = simd32< std::uint8_t >
 A 32-component SIMD vector with std::uint8_t components. More...
 
using tue::uint8x64 = simd64< std::uint8_t >
 A 64-component SIMD vector with std::uint8_t components. More...
 
using tue::uint16x2 = simd2< std::uint16_t >
 A 2-component SIMD vector with std::uint16_t components. More...
 
using tue::uint16x4 = simd4< std::uint16_t >
 A 4-component SIMD vector with std::uint16_t components. More...
 
using tue::uint16x8 = simd8< std::uint16_t >
 An 8-component SIMD vector with std::uint16_t components. More...
 
using tue::uint16x16 = simd16< std::uint16_t >
 A 16-component SIMD vector with std::uint16_t components. More...
 
using tue::uint16x32 = simd32< std::uint16_t >
 A 32-component SIMD vector with std::uint16_t components. More...
 
using tue::uint32x2 = simd2< std::uint32_t >
 A 2-component SIMD vector with std::uint32_t components. More...
 
using tue::uint32x4 = simd4< std::uint32_t >
 A 4-component SIMD vector with std::uint32_t components. More...
 
using tue::uint32x8 = simd8< std::uint32_t >
 An 8-component SIMD vector with std::uint32_t components. More...
 
using tue::uint32x16 = simd16< std::uint32_t >
 A 16-component SIMD vector with std::uint32_t components. More...
 
using tue::uint64x2 = simd2< std::uint64_t >
 A 2-component SIMD vector with std::uint64_t components. More...
 
using tue::uint64x4 = simd4< std::uint64_t >
 A 4-component SIMD vector with std::uint64_t components. More...
 
using tue::uint64x8 = simd8< std::uint64_t >
 An 8-component SIMD vector with std::uint64_t components. More...
 
using tue::bool8x2 = simd2< bool8 >
 A 2-component SIMD vector with bool8 components. More...
 
using tue::bool8x4 = simd4< bool8 >
 A 4-component SIMD vector with bool8 components. More...
 
using tue::bool8x8 = simd8< bool8 >
 An 8-component SIMD vector with bool8 components. More...
 
using tue::bool8x16 = simd16< bool8 >
 A 16-component SIMD vector with bool8 components. More...
 
using tue::bool8x32 = simd32< bool8 >
 A 32-component SIMD vector with bool8 components. More...
 
using tue::bool8x64 = simd64< bool8 >
 A 64-component SIMD vector with bool8 components. More...
 
using tue::bool16x2 = simd2< bool16 >
 A 2-component SIMD vector with bool16 components. More...
 
using tue::bool16x4 = simd4< bool16 >
 A 4-component SIMD vector with bool16 components. More...
 
using tue::bool16x8 = simd8< bool16 >
 An 8-component SIMD vector with bool16 components. More...
 
using tue::bool16x16 = simd16< bool16 >
 A 16-component SIMD vector with bool16 components. More...
 
using tue::bool16x32 = simd32< bool16 >
 A 32-component SIMD vector with bool16 components. More...
 
using tue::bool32x2 = simd2< bool32 >
 A 2-component SIMD vector with bool32 components. More...
 
using tue::bool32x4 = simd4< bool32 >
 A 4-component SIMD vector with bool32 components. More...
 
using tue::bool32x8 = simd8< bool32 >
 An 8-component SIMD vector with bool32 components. More...
 
using tue::bool32x16 = simd16< bool32 >
 A 16-component SIMD vector with bool32 components. More...
 
using tue::bool64x2 = simd2< bool64 >
 A 2-component SIMD vector with bool64 components. More...
 
using tue::bool64x4 = simd4< bool64 >
 A 4-component SIMD vector with bool64 components. More...
 
using tue::bool64x8 = simd8< bool64 >
 An 8-component SIMD vector with bool64 components. More...
 

Functions

template<typename T , int N>
std::enable_if_t< std::is_signed< T >::value, simd< T, N > > tue::operator+ (const simd< T, N > &s) noexcept
 Computes the unary plus of each component of s. More...
 
template<typename T , int N>
simd< T, N > & tue::operator++ (simd< T, N > &s) noexcept
 Pre-increments each component of s. More...
 
template<typename T , int N>
simd< T, N > tue::operator++ (simd< T, N > &s, int) noexcept
 Post-increments each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_signed< T >::value, simd< T, N > > tue::operator- (const simd< T, N > &s) noexcept
 Computes the unary minus of each component of s. More...
 
template<typename T , int N>
simd< T, N > & tue::operator-- (simd< T, N > &s) noexcept
 Pre-decrements each component of s. More...
 
template<typename T , int N>
simd< T, N > tue::operator-- (simd< T, N > &s, int) noexcept
 Post-decrements each component of s. More...
 
template<typename T , int N>
simd< T, N > tue::operator~ (const simd< T, N > &s) noexcept
 Computes the bitwise NOT of each component of s. More...
 
template<typename T , int N>
simd< T, N > tue::operator+ (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the sums of each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator- (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the differences between each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator* (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the products of each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator/ (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the quotients of each component of lhs over each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator% (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the modulos of each component of lhs over each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator& (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the bitwise AND of each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator| (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the bitwise OR of each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator^ (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes the bitwise XOR of each component of lhs and each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator<< (const simd< T, N > &lhs, int rhs) noexcept
 Computes the bitwise shifts left of each component of lhs by rhs. More...
 
template<typename T , int N>
simd< T, N > tue::operator>> (const simd< T, N > &lhs, int rhs) noexcept
 Computes the bitwise shifts right of each component of lhs by rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator+= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Adds each component of rhs to each corresponding component of lhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator-= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Subtracts each component of rhs from each corresponding component of lhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator*= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Multiplies each component of lhs by each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator/= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Divides each component of lhs by each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator%= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Modulos each component of lhs by each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator&= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Bitwise ANDs each component of lhs with each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator|= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Bitwise ORs each component of lhs with each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator^= (simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Bitwise XORs each component of lhs with each corresponding component of rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator<<= (simd< T, N > &lhs, int rhs) noexcept
 Bitwise shifts left each component of lhs by rhs. More...
 
template<typename T , int N>
simd< T, N > & tue::operator>>= (simd< T, N > &lhs, int rhs) noexcept
 Bitwise shifts right each component of lhs by rhs. More...
 
template<typename T , int N>
bool tue::operator== (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Determines whether or not two simd's compare equal. More...
 
template<typename T , int N>
bool tue::operator!= (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Determines whether or not two simd's compare not equal. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::sin (const simd< T, N > &s) noexcept
 Computes tue::math::sin() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::cos (const simd< T, N > &s) noexcept
 Computes tue::math::cos() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value > tue::math::sincos (const simd< T, N > &s, simd< T, N > &sin_out, simd< T, N > &cos_out) noexcept
 Computes tue::math::sincos() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::exp (const simd< T, N > &s) noexcept
 Computes tue::math::exp() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::log (const simd< T, N > &s) noexcept
 Computes tue::math::log() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_arithmetic< T >::value, simd< T, N > > tue::math::abs (const simd< T, N > &s) noexcept
 Computes tue::math::abs() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::pow (const simd< T, N > &bases, const simd< T, N > &exponents) noexcept
 Computes tue::math::pow() for each component of bases and each corresponding component of exponents. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::recip (const simd< T, N > &s) noexcept
 Computes tue::math::recip() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::sqrt (const simd< T, N > &s) noexcept
 Computes tue::math::sqrt() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_floating_point< T >::value, simd< T, N > > tue::math::rsqrt (const simd< T, N > &s) noexcept
 Computes tue::math::rsqrt() for each component of s. More...
 
template<typename T , int N>
std::enable_if_t< std::is_arithmetic< T >::value, simd< T, N > > tue::math::min (const simd< T, N > &s1, const simd< T, N > &s2) noexcept
 Computes tue::math::min() for each corresponding pair of components from s1 and s2. More...
 
template<typename T , int N>
std::enable_if_t< std::is_arithmetic< T >::value, simd< T, N > > tue::math::max (const simd< T, N > &s1, const simd< T, N > &s2) noexcept
 Computes tue::math::max() for each corresponding pair of components from s1 and s2. More...
 
template<typename T , typename U , int N>
std::enable_if_t< is_sized_bool< T >::value &&sizeof(T)==sizeof(U), simd< U, N > > tue::math::mask (const simd< T, N > &conditions, const simd< U, N > &values) noexcept
 Computes tue::math::mask() for each corresponding pair of components from conditions and values. More...
 
template<typename T , typename U , int N>
std::enable_if_t< is_sized_bool< T >::value &&sizeof(T)==sizeof(U), simd< U, N > > tue::math::select (const simd< T, N > &conditions, const simd< U, N > &values, const simd< U, N > &otherwise) noexcept
 Computes tue::math::select() for each corresponding trio of components from conditions, values, and otherwise. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::less (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::less() for each corresponding pair of components from lhs and rhs. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::less_equal (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::less_equal() for each corresponding pair of components from lhs and rhs. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::greater (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::greater() for each corresponding pair of components from lhs and rhs. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::greater_equal (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::greater_equal() for each corresponding pair of components from lhs and rhs. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::equal (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::equal() for each corresponding pair of components from lhs and rhs. More...
 
template<typename T , int N>
simd< sized_bool_t< sizeof(T)>, N > tue::math::not_equal (const simd< T, N > &lhs, const simd< T, N > &rhs) noexcept
 Computes tue::math::not_equal() for each corresponding pair of components from lhs and rhs. More...
 

Class Documentation

struct tue::is_simd_component

template<typename T>
struct tue::is_simd_component< T >

Checks if a type can be used as the component type of an SIMD vector.

Extends std::integral_constant<bool, true> for the following types and std::integral_constant<bool, false> otherwise:

  • float
  • double
  • std::int8_t
  • std::int16_t
  • std::int32_t
  • std::int64_t
  • std::uint8_t
  • std::uint16_t
  • std::uint32_t
  • std::uint64_t
  • tue::bool8
  • tue::bool16
  • tue::bool32
  • tue::bool64
Template Parameters
TThe type to check.
struct tue::is_arithmetic_simd_component

template<typename T>
struct tue::is_arithmetic_simd_component< T >

Checks if a type is an arithmetic type that can be used as the component type of an SIMD vector.

Extends std::integral_constant<bool, true> for the following types and std::integral_constant<bool, false> otherwise:

  • float
  • double
  • std::int8_t
  • std::int16_t
  • std::int32_t
  • std::int64_t
  • std::uint8_t
  • std::uint16_t
  • std::uint32_t
  • std::uint64_t
Template Parameters
TThe type to check.
struct tue::is_floating_point_simd_component

template<typename T>
struct tue::is_floating_point_simd_component< T >

Checks if a type is a floating-point type that can be used as the component type of an SIMD vector.

Extends std::integral_constant<bool, true> for the following types and std::integral_constant<bool, false> otherwise:

  • float
  • double
Template Parameters
TThe type to check.
struct tue::is_integral_simd_component

template<typename T>
struct tue::is_integral_simd_component< T >

Checks if a type is an integral type that can be used as the component type of an SIMD vector.

Extends std::integral_constant<bool, true> for the following types and std::integral_constant<bool, false> otherwise:

  • std::int8_t
  • std::int16_t
  • std::int32_t
  • std::int64_t
  • std::uint8_t
  • std::uint16_t
  • std::uint32_t
  • std::uint64_t
Template Parameters
TThe type to check.
class tue::simd

template<typename T, int N>
class tue::simd< T, N >

An N-component SIMD vector.

simd has the same size requirements as T[N] and its alignment equals its size. It's accelerated by compiler and architecture-specific SIMD intrinsics where possible, but compatibility fallbacks are always available otherwise.

simd types may contain platform-specific implicit constructors and conversion operators for converting to and from the underlying SIMD intrinsic type. The current mapping is as follows:

SSE

simd Type SIMD Intrinsic
bool32x4 __m128
float32x4 __m128

SSE2

simd Type SIMD Intrinsic
bool8x16 __m128i
bool16x8 __m128i
bool32x4 __m128i and __m128
bool64x2 __m128i and __m128d
int8x16 __m128i
int16x8 __m128i
int32x4 __m128i
int64x2 __m128i
uint8x16 __m128i
uint16x8 __m128i
uint32x4 __m128i
uint64x2 __m128i
float32x4 __m128
float64x2 __m128d
Template Parameters
TThe component type. is_simd_component<T>value must be true.
NThe component count. Must be 2, 4, 8, 16, 32, or 64.

Public Types

using component_type = T
 This simd type's component type. More...
 

Static Public Attributes

static constexpr int component_count = N
 This simd type's component count. More...
 
static constexpr bool is_accelerated = false
 Whether or not this type is accelerated by SIMD intrinsics. More...
 

Constructors, Conversions, and Factory Functions

 simd () noexcept=default
 Default constructs each component. More...
 
 simd (T x) noexcept
 Constructs each component with the same value. More...
 
template<int M = N, typename = std::enable_if_t<M == 2>>
 simd (T x, T y) noexcept
 Constructs each component with the value of the corresponding argument. More...
 
template<int M = N, typename = std::enable_if_t<M == 4>>
 simd (T x, T y, T z, T w) noexcept
 Constructs each component with the value of the corresponding argument. More...
 
template<int M = N, typename = std::enable_if_t<M == 8>>
 simd (T s0, T s1, T s2, T s3, T s4, T s5, T s6, T s7) noexcept
 Constructs each component with the value of the corresponding argument. More...
 
template<int M = N, typename = std::enable_if_t<M == 16>>
 simd (T s0, T s1, T s2, T s3, T s4, T s5, T s6, T s7, T s8, T s9, T s10, T s11, T s12, T s13, T s14, T s15) noexcept
 Constructs each component with the value of the corresponding argument. More...
 
template<typename U >
 simd (const simd< U, N > &s) noexcept
 Explicitly casts another simd to a new component type. More...
 
static simd< T, N > zero () noexcept
 Returns an simd with each component set to 0. More...
 
static simd< T, N > load (const T *data) noexcept
 Loads the given aligned component array into a new simd. More...
 
static simd< T, N > loadu (const T *data) noexcept
 Loads the given unaligned component array into a new simd. More...
 

Public Member Functions

void store (T *data) const noexcept
 Store's this simd's underlying component array in the given aligned component array. More...
 
void storeu (T *data) const noexcept
 Store's this simd's underlying component array in the given unaligned component array. More...
 
const T * data () const noexcept
 Returns a pointer to this simd's underlying component array. More...
 
T * data () noexcept
 Returns a pointer to this simd's underlying component array. More...
 

Member Typedef Documentation

template<typename T , int N>
using tue::simd< T, N >::component_type = T

This simd type's component type.

Member Data Documentation

template<typename T , int N>
constexpr int tue::simd< T, N >::component_count = N
static

This simd type's component count.

template<typename T , int N>
constexpr bool tue::simd< T, N >::is_accelerated = false
static

Whether or not this type is accelerated by SIMD intrinsics.

Constructor & Destructor Documentation

template<typename T , int N>
tue::simd< T, N >::simd ( )
defaultnoexcept

Default constructs each component.

template<typename T , int N>
tue::simd< T, N >::simd ( x)
inlineexplicitnoexcept

Constructs each component with the same value.

Parameters
xThe value to construct each component with.
template<typename T , int N>
template<int M = N, typename = std::enable_if_t<M == 2>>
tue::simd< T, N >::simd ( x,
y 
)
inlinenoexcept

Constructs each component with the value of the corresponding argument.

This overload is only available when N equals 2.

Parameters
xThe value to construct the first component with.
yThe value to construct the second component with.
template<typename T , int N>
template<int M = N, typename = std::enable_if_t<M == 4>>
tue::simd< T, N >::simd ( x,
y,
z,
w 
)
inlinenoexcept

Constructs each component with the value of the corresponding argument.

This overload is only available when N equals 4.

Parameters
xThe value to construct the first component with.
yThe value to construct the second component with.
zThe value to construct the third component with.
wThe value to construct the fourth component with.
template<typename T , int N>
template<int M = N, typename = std::enable_if_t<M == 8>>
tue::simd< T, N >::simd ( s0,
s1,
s2,
s3,
s4,
s5,
s6,
s7 
)
inlinenoexcept

Constructs each component with the value of the corresponding argument.

This overload is only available when N equals 8.

Parameters
s0The value to construct the first component with.
s1The value to construct the second component with.
s2The value to construct the third component with.
s3The value to construct the fourth component with.
s4The value to construct the fifth component with.
s5The value to construct the sixth component with.
s6The value to construct the seventh component with.
s7The value to construct the eighth component with.
template<typename T , int N>
template<int M = N, typename = std::enable_if_t<M == 16>>
tue::simd< T, N >::simd ( s0,
s1,
s2,
s3,
s4,
s5,
s6,
s7,
s8,
s9,
s10,
s11,
s12,
s13,
s14,
s15 
)
inlinenoexcept

Constructs each component with the value of the corresponding argument.

This overload is only available when N equals 16.

Parameters
s0The value to construct the first component with.
s1The value to construct the second component with.
s2The value to construct the third component with.
s3The value to construct the fourth component with.
s4The value to construct the fifth component with.
s5The value to construct the sixth component with.
s6The value to construct the seventh component with.
s7The value to construct the eighth component with.
s8The value to construct the ninth component with.
s9The value to construct the tenth component with.
s10The value to construct the eleventh component with.
s11The value to construct the twelfth component with.
s12The value to construct the thirteenth component with.
s13The value to construct the fourteenth component with.
s14The value to construct the fifteenth component with.
s15The value to construct the sixteenth component with.
template<typename T , int N>
template<typename U >
tue::simd< T, N >::simd ( const simd< U, N > &  s)
inlineexplicitnoexcept

Explicitly casts another simd to a new component type.

Template Parameters
UThe component type of s.
Parameters
sThe simd to cast from.

Member Function Documentation

template<typename T , int N>
static simd<T, N> tue::simd< T, N >::zero ( )
inlinestaticnoexcept

Returns an simd with each component set to 0.

Returns
An simd with each component set to 0.
template<typename T , int N>
static simd<T, N> tue::simd< T, N >::load ( const T *  data)
inlinestaticnoexcept

Loads the given aligned component array into a new simd.

The source array must have the same alignment as this simd type. If the source array is null, unaligned, or doesn't contain at least N components, behavior is undefined.

Parameters
dataThe source component array.
Returns
The new simd.
template<typename T , int N>
static simd<T, N> tue::simd< T, N >::loadu ( const T *  data)
inlinestaticnoexcept

Loads the given unaligned component array into a new simd.

If the source array is null or doesn't contain at least N components, behavior is undefined.

Parameters
dataThe source component array.
Returns
The new simd.
template<typename T , int N>
void tue::simd< T, N >::store ( T *  data) const
inlinenoexcept

Store's this simd's underlying component array in the given aligned component array.

The destination array must have the same alignment as this simd type. If the destination array is null, unaligned, or doesn't contain room for all N components, behavior is undefined.

Parameters
dataThe destination component array.
template<typename T , int N>
void tue::simd< T, N >::storeu ( T *  data) const
inlinenoexcept

Store's this simd's underlying component array in the given unaligned component array.

If the destination array is null or doesn't contain room for all N components, behavior is undefined.

Parameters
dataThe destination component array.
template<typename T , int N>
const T* tue::simd< T, N >::data ( ) const
inlinenoexcept

Returns a pointer to this simd's underlying component array.

Returns
A pointer to this simd's underlying component array.
template<typename T , int N>
T* tue::simd< T, N >::data ( )
inlinenoexcept

Returns a pointer to this simd's underlying component array.

Returns
A pointer to this simd's underlying component array.

Macro Definition Documentation

#define TUE_SSE

Defined if the current compiler configuration supports SSE intrinsics.

#define TUE_SSE2

Defined if the current compiler configuration supports SSE2 intrinsics.

Typedef Documentation

template<typename T >
using tue::simd2 = typedef simd<T, 2>

A 2-component SIMD vector.

Template Parameters
TThe component type.
template<typename T >
using tue::simd4 = typedef simd<T, 4>

A 4-component SIMD vector.

Template Parameters
TThe component type.
template<typename T >
using tue::simd8 = typedef simd<T, 8>

An 8-component SIMD vector.

Template Parameters
TThe component type.
template<typename T >
using tue::simd16 = typedef simd<T, 16>

A 16-component SIMD vector.

Template Parameters
TThe component type.
template<typename T >
using tue::simd32 = typedef simd<T, 32>

A 32-component SIMD vector.

Template Parameters
TThe component type.
template<typename T >
using tue::simd64 = typedef simd<T, 64>

A 64-component SIMD vector.

Template Parameters
TThe component type.
using tue::float32x2 = typedef simd2<float>

A 2-component SIMD vector with float components.

using tue::float32x4 = typedef simd4<float>

A 4-component SIMD vector with float components.

using tue::float32x8 = typedef simd8<float>

An 8-component SIMD vector with float components.

using tue::float32x16 = typedef simd16<float>

A 16-component SIMD vector with float components.

using tue::float64x2 = typedef simd2<double>

A 2-component SIMD vector with double components.

using tue::float64x4 = typedef simd4<double>

A 4-component SIMD vector with double components.

using tue::float64x8 = typedef simd8<double>

An 8-component SIMD vector with double components.

using tue::int8x2 = typedef simd2<std::int8_t>

A 2-component SIMD vector with std::int8_t components.

using tue::int8x4 = typedef simd4<std::int8_t>

A 4-component SIMD vector with std::int8_t components.

using tue::int8x8 = typedef simd8<std::int8_t>

An 8-component SIMD vector with std::int8_t components.

using tue::int8x16 = typedef simd16<std::int8_t>

A 16-component SIMD vector with std::int8_t components.

using tue::int8x32 = typedef simd32<std::int8_t>

A 32-component SIMD vector with std::int8_t components.

using tue::int8x64 = typedef simd64<std::int8_t>

A 64-component SIMD vector with std::int8_t components.

using tue::int16x2 = typedef simd2<std::int16_t>

A 2-component SIMD vector with std::int16_t components.

using tue::int16x4 = typedef simd4<std::int16_t>

A 4-component SIMD vector with std::int16_t components.

using tue::int16x8 = typedef simd8<std::int16_t>

An 8-component SIMD vector with std::int16_t components.

using tue::int16x16 = typedef simd16<std::int16_t>

A 16-component SIMD vector with std::int16_t components.

using tue::int16x32 = typedef simd32<std::int16_t>

A 32-component SIMD vector with std::int16_t components.

using tue::int32x2 = typedef simd2<std::int32_t>

A 2-component SIMD vector with std::int32_t components.

using tue::int32x4 = typedef simd4<std::int32_t>

A 4-component SIMD vector with std::int32_t components.

using tue::int32x8 = typedef simd8<std::int32_t>

An 8-component SIMD vector with std::int32_t components.

using tue::int32x16 = typedef simd16<std::int32_t>

A 16-component SIMD vector with std::int32_t components.

using tue::int64x2 = typedef simd2<std::int64_t>

A 2-component SIMD vector with std::int64_t components.

using tue::int64x4 = typedef simd4<std::int64_t>

A 4-component SIMD vector with std::int64_t components.

using tue::int64x8 = typedef simd8<std::int64_t>

An 8-component SIMD vector with std::int64_t components.

using tue::uint8x2 = typedef simd2<std::uint8_t>

A 2-component SIMD vector with std::uint8_t components.

using tue::uint8x4 = typedef simd4<std::uint8_t>

A 4-component SIMD vector with std::uint8_t components.

using tue::uint8x8 = typedef simd8<std::uint8_t>

An 8-component SIMD vector with std::uint8_t components.

using tue::uint8x16 = typedef simd16<std::uint8_t>

A 16-component SIMD vector with std::uint8_t components.

using tue::uint8x32 = typedef simd32<std::uint8_t>

A 32-component SIMD vector with std::uint8_t components.

using tue::uint8x64 = typedef simd64<std::uint8_t>

A 64-component SIMD vector with std::uint8_t components.

using tue::uint16x2 = typedef simd2<std::uint16_t>

A 2-component SIMD vector with std::uint16_t components.

using tue::uint16x4 = typedef simd4<std::uint16_t>

A 4-component SIMD vector with std::uint16_t components.

using tue::uint16x8 = typedef simd8<std::uint16_t>

An 8-component SIMD vector with std::uint16_t components.

using tue::uint16x16 = typedef simd16<std::uint16_t>

A 16-component SIMD vector with std::uint16_t components.

using tue::uint16x32 = typedef simd32<std::uint16_t>

A 32-component SIMD vector with std::uint16_t components.

using tue::uint32x2 = typedef simd2<std::uint32_t>

A 2-component SIMD vector with std::uint32_t components.

using tue::uint32x4 = typedef simd4<std::uint32_t>

A 4-component SIMD vector with std::uint32_t components.

using tue::uint32x8 = typedef simd8<std::uint32_t>

An 8-component SIMD vector with std::uint32_t components.

using tue::uint32x16 = typedef simd16<std::uint32_t>

A 16-component SIMD vector with std::uint32_t components.

using tue::uint64x2 = typedef simd2<std::uint64_t>

A 2-component SIMD vector with std::uint64_t components.

using tue::uint64x4 = typedef simd4<std::uint64_t>

A 4-component SIMD vector with std::uint64_t components.

using tue::uint64x8 = typedef simd8<std::uint64_t>

An 8-component SIMD vector with std::uint64_t components.

using tue::bool8x2 = typedef simd2<bool8>

A 2-component SIMD vector with bool8 components.

using tue::bool8x4 = typedef simd4<bool8>

A 4-component SIMD vector with bool8 components.

using tue::bool8x8 = typedef simd8<bool8>

An 8-component SIMD vector with bool8 components.

using tue::bool8x16 = typedef simd16<bool8>

A 16-component SIMD vector with bool8 components.

using tue::bool8x32 = typedef simd32<bool8>

A 32-component SIMD vector with bool8 components.

using tue::bool8x64 = typedef simd64<bool8>

A 64-component SIMD vector with bool8 components.

using tue::bool16x2 = typedef simd2<bool16>

A 2-component SIMD vector with bool16 components.

using tue::bool16x4 = typedef simd4<bool16>

A 4-component SIMD vector with bool16 components.

using tue::bool16x8 = typedef simd8<bool16>

An 8-component SIMD vector with bool16 components.

using tue::bool16x16 = typedef simd16<bool16>

A 16-component SIMD vector with bool16 components.

using tue::bool16x32 = typedef simd32<bool16>

A 32-component SIMD vector with bool16 components.

using tue::bool32x2 = typedef simd2<bool32>

A 2-component SIMD vector with bool32 components.

using tue::bool32x4 = typedef simd4<bool32>

A 4-component SIMD vector with bool32 components.

using tue::bool32x8 = typedef simd8<bool32>

An 8-component SIMD vector with bool32 components.

using tue::bool32x16 = typedef simd16<bool32>

A 16-component SIMD vector with bool32 components.

using tue::bool64x2 = typedef simd2<bool64>

A 2-component SIMD vector with bool64 components.

using tue::bool64x4 = typedef simd4<bool64>

A 4-component SIMD vector with bool64 components.

using tue::bool64x8 = typedef simd8<bool64>

An 8-component SIMD vector with bool64 components.

Function Documentation

template<typename T , int N>
std::enable_if_t<std::is_signed<T>::value, simd<T, N> > tue::operator+ ( const simd< T, N > &  s)
inlinenoexcept

Computes the unary plus of each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
The unary plus of each component of s.
template<typename T , int N>
simd<T, N>& tue::operator++ ( simd< T, N > &  s)
inlinenoexcept

Pre-increments each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
A reference to s.
template<typename T , int N>
simd<T, N> tue::operator++ ( simd< T, N > &  s,
int   
)
inlinenoexcept

Post-increments each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
A copy of s before being incremented.
template<typename T , int N>
std::enable_if_t<std::is_signed<T>::value, simd<T, N> > tue::operator- ( const simd< T, N > &  s)
inlinenoexcept

Computes the unary minus of each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
The unary minus of each component of s.
template<typename T , int N>
simd<T, N>& tue::operator-- ( simd< T, N > &  s)
inlinenoexcept

Pre-decrements each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
A reference to s.
template<typename T , int N>
simd<T, N> tue::operator-- ( simd< T, N > &  s,
int   
)
inlinenoexcept

Post-decrements each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
A copy of s before being decremented.
template<typename T , int N>
simd<T, N> tue::operator~ ( const simd< T, N > &  s)
inlinenoexcept

Computes the bitwise NOT of each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
The bitwise NOT of each component of s.
template<typename T , int N>
simd<T, N> tue::operator+ ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the sums of each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The sums of each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator- ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the differences between each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The differences between each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator* ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the products of each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The products of each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator/ ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the quotients of each component of lhs over each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The quotients of each component of lhs over each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator% ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the modulos of each component of lhs over each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The modulos of each component of lhs over each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator& ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the bitwise AND of each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise AND of each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator| ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the bitwise OR of each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise OR of each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator^ ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes the bitwise XOR of each component of lhs and each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise XOR of each component of lhs and each corresponding component of rhs.
template<typename T , int N>
simd<T, N> tue::operator<< ( const simd< T, N > &  lhs,
int  rhs 
)
inlinenoexcept

Computes the bitwise shifts left of each component of lhs by rhs.

Template Parameters
TThe component type of lhs.
NThe component count of lhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise shifts left of each component of lhs by rhs.
template<typename T , int N>
simd<T, N> tue::operator>> ( const simd< T, N > &  lhs,
int  rhs 
)
inlinenoexcept

Computes the bitwise shifts right of each component of lhs by rhs.

Template Parameters
TThe component type of lhs.
NThe component count of lhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise shifts right of each component of lhs by rhs.
template<typename T , int N>
simd<T, N>& tue::operator+= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Adds each component of rhs to each corresponding component of lhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator-= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Subtracts each component of rhs from each corresponding component of lhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator*= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Multiplies each component of lhs by each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator/= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Divides each component of lhs by each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator%= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Modulos each component of lhs by each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator&= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Bitwise ANDs each component of lhs with each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator|= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Bitwise ORs each component of lhs with each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator^= ( simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Bitwise XORs each component of lhs with each corresponding component of rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator<<= ( simd< T, N > &  lhs,
int  rhs 
)
inlinenoexcept

Bitwise shifts left each component of lhs by rhs.

Template Parameters
TThe component type of lhs.
NThe component count of lhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
simd<T, N>& tue::operator>>= ( simd< T, N > &  lhs,
int  rhs 
)
inlinenoexcept

Bitwise shifts right each component of lhs by rhs.

Template Parameters
TThe component type of lhs.
NThe component count of lhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T , int N>
bool tue::operator== ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Determines whether or not two simd's compare equal.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
true if all the corresponding pairs of components compare equal and false otherwise.
template<typename T , int N>
bool tue::operator!= ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Determines whether or not two simd's compare not equal.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
true if at least one of the corresponding pairs of components compares not equal and false otherwise.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::sin ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::sin() for each component of s.

The results may not match tue::math::sin() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::sin() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::cos ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::cos() for each component of s.

The results may not match tue::math::cos() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::cos() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value> tue::math::sincos ( const simd< T, N > &  s,
simd< T, N > &  sin_out,
simd< T, N > &  cos_out 
)
inlinenoexcept

Computes tue::math::sincos() for each component of s.

The results may not match tue::math::sincos() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
sin_outA reference to the simd to store the sin() results in.
cos_outA reference to the simd to store the cos() results in.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::exp ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::exp() for each component of s.

The results may not match tue::math::exp() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::exp() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::log ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::log() for each component of s.

The results may not match tue::math::log() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::log() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_arithmetic<T>::value, simd<T, N> > tue::math::abs ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::abs() for each component of s.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::abs() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::pow ( const simd< T, N > &  bases,
const simd< T, N > &  exponents 
)
inlinenoexcept

Computes tue::math::pow() for each component of bases and each corresponding component of exponents.

The results may not match tue::math::pow() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of both bases and exponents.
NThe component count of both bases and exponents.
Parameters
basesThe bases.
exponentsThe exponents.
Returns
tue::math::pow() for each component of bases and each corresponding component of exponents.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::recip ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::recip() for each component of s.

The results may not match tue::math::recip() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::recip() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::sqrt ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::sqrt() for each component of s.

The results may not match tue::math::sqrt() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::sqrt() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_floating_point<T>::value, simd<T, N> > tue::math::rsqrt ( const simd< T, N > &  s)
inlinenoexcept

Computes tue::math::rsqrt() for each component of s.

The results may not match tue::math::rsqrt() exactly, but will at least approximate the same values.

Template Parameters
TThe component type of s.
NThe component count of s.
Parameters
sAn simd.
Returns
tue::math::rsqrt() for each component of s.
template<typename T , int N>
std::enable_if_t<std::is_arithmetic<T>::value, simd<T, N> > tue::math::min ( const simd< T, N > &  s1,
const simd< T, N > &  s2 
)
inlinenoexcept

Computes tue::math::min() for each corresponding pair of components from s1 and s2.

Template Parameters
TThe component type of both s1 and s2.
NThe component count of both s1 and s2.
Parameters
s1An simd.
s2Another simd.
Returns
tue::math::min() for each corresponding pair of components from s1 and s2.
template<typename T , int N>
std::enable_if_t<std::is_arithmetic<T>::value, simd<T, N> > tue::math::max ( const simd< T, N > &  s1,
const simd< T, N > &  s2 
)
inlinenoexcept

Computes tue::math::max() for each corresponding pair of components from s1 and s2.

Template Parameters
TThe component type of both s1 and s2.
NThe component count of both s1 and s2.
Parameters
s1An simd.
s2Another simd.
Returns
tue::math::max() for each corresponding pair of components from s1 and s2.
template<typename T , typename U , int N>
std::enable_if_t< is_sized_bool<T>::value && sizeof(T) == sizeof(U), simd<U, N> > tue::math::mask ( const simd< T, N > &  conditions,
const simd< U, N > &  values 
)
inlinenoexcept

Computes tue::math::mask() for each corresponding pair of components from conditions and values.

Template Parameters
TThe component type of conditions.
UThe component type of values.
NThe component count of both conditions and values.
Parameters
conditionsAn simd.
valuesAnother simd.
Returns
tue::math::mask() for each corresponding pair of components from conditions and values.
template<typename T , typename U , int N>
std::enable_if_t< is_sized_bool<T>::value && sizeof(T) == sizeof(U), simd<U, N> > tue::math::select ( const simd< T, N > &  conditions,
const simd< U, N > &  values,
const simd< U, N > &  otherwise 
)
inlinenoexcept

Computes tue::math::select() for each corresponding trio of components from conditions, values, and otherwise.

Template Parameters
TThe component type of conditions.
UThe component type of values and otherwise.
NThe component count of all three parameters.
Parameters
conditionsAn simd.
valuesAnother simd.
otherwiseAnother simd.
Returns
tue::math::select() for each corresponding trio of components from conditions, values, and otherwise.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::less ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::less() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::less() for each corresponding pair of components from lhs and rhs.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::less_equal ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::less_equal() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::less_equal() for each corresponding pair of components from lhs and rhs.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::greater ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::greater() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::greater() for each corresponding pair of components from lhs and rhs.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::greater_equal ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::greater_equal() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::greater_equal() for each corresponding pair of components from lhs and rhs.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::equal ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::equal() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::equal() for each corresponding pair of components from lhs and rhs.
template<typename T , int N>
simd<sized_bool_t<sizeof(T)>, N> tue::math::not_equal ( const simd< T, N > &  lhs,
const simd< T, N > &  rhs 
)
inlinenoexcept

Computes tue::math::not_equal() for each corresponding pair of components from lhs and rhs.

Template Parameters
TThe component type of both lhs and rhs.
NThe component count of both lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
tue::math::not_equal() for each corresponding pair of components from lhs and rhs.