VCV Rack API v2
Loading...
Searching...
No Matches
rack::simd::Vector< float, 4 > Struct Reference

Wrapper for __m128 representing an aligned vector of 4 single-precision float values. More...

#include <Vector.hpp>

Collaboration diagram for rack::simd::Vector< float, 4 >:
[legend]

Public Types

using type = float
 

Public Member Functions

 Vector ()=default
 Constructs an uninitialized vector.
 
 Vector (__m128 v)
 Constructs a vector from a native __m128 type.
 
 Vector (float x)
 Constructs a vector with all elements set to x.
 
 Vector (float x1, float x2, float x3, float x4)
 Constructs a vector from four scalars.
 
void store (float *x)
 Writes an array of 4 values.
 
float & operator[] (int i)
 Accessing vector elements individually is slow and defeats the purpose of vectorizing.
 
const float & operator[] (int i) const
 
 Vector (Vector< int32_t, 4 > a)
 

Static Public Member Functions

static Vector zero ()
 Returns a vector with all 0 bits.
 
static Vector mask ()
 Returns a vector with all 1 bits.
 
static Vector load (const float *x)
 Reads an array of 4 values.
 
static Vector cast (Vector< int32_t, 4 > a)
 

Public Attributes

union rack::simd::Vector< float, 4 >:: { ... }  
 

Static Public Attributes

static constexpr int size = 4
 

Detailed Description

Wrapper for __m128 representing an aligned vector of 4 single-precision float values.

Member Typedef Documentation

◆ type

using rack::simd::Vector< float, 4 >::type = float

Constructor & Destructor Documentation

◆ Vector() [1/5]

rack::simd::Vector< float, 4 >::Vector ( )
default

Constructs an uninitialized vector.

◆ Vector() [2/5]

rack::simd::Vector< float, 4 >::Vector ( __m128 v)
inline

Constructs a vector from a native __m128 type.

◆ Vector() [3/5]

rack::simd::Vector< float, 4 >::Vector ( float x)
inline

Constructs a vector with all elements set to x.

◆ Vector() [4/5]

rack::simd::Vector< float, 4 >::Vector ( float x1,
float x2,
float x3,
float x4 )
inline

Constructs a vector from four scalars.

◆ Vector() [5/5]

rack::simd::Vector< float, 4 >::Vector ( Vector< int32_t, 4 > a)
inline

Member Function Documentation

◆ zero()

static Vector rack::simd::Vector< float, 4 >::zero ( )
inlinestatic

Returns a vector with all 0 bits.

◆ mask()

static Vector rack::simd::Vector< float, 4 >::mask ( )
inlinestatic

Returns a vector with all 1 bits.

◆ load()

static Vector rack::simd::Vector< float, 4 >::load ( const float * x)
inlinestatic

Reads an array of 4 values.

On little-endian machines (e.g. x86_64), the order is reversed, so x[0] corresponds to vector.s[3].

◆ store()

void rack::simd::Vector< float, 4 >::store ( float * x)
inline

Writes an array of 4 values.

On little-endian machines (e.g. x86_64), the order is reversed, so x[0] corresponds to vector.s[3].

◆ operator[]() [1/2]

float & rack::simd::Vector< float, 4 >::operator[] ( int i)
inline

Accessing vector elements individually is slow and defeats the purpose of vectorizing.

However, this operator is convenient when writing simple serial code in a non-bottlenecked section.

◆ operator[]() [2/2]

const float & rack::simd::Vector< float, 4 >::operator[] ( int i) const
inline

◆ cast()

Vector< float, 4 > rack::simd::Vector< float, 4 >::cast ( Vector< int32_t, 4 > a)
inlinestatic

Member Data Documentation

◆ size

int rack::simd::Vector< float, 4 >::size = 4
staticconstexpr

◆ v

__m128 rack::simd::Vector< float, 4 >::v

◆ s

float rack::simd::Vector< float, 4 >::s[4]

Accessing this array of scalars is slow and defeats the purpose of vectorizing.

◆ []

union rack::simd::Vector< float, 4 > { ... } rack::simd::Vector< float, 4 >

The documentation for this struct was generated from the following file: