Math v0.0.1
i32x4

SIMD 4 component 32bit signed integer vector structure. (int4) More...

#include <int.hpp>

Public Member Functions

 i32x4 (const i32x4 &v)=default
 
i32x4operator= (const i32x4 &v)=default
 
 i32x4 () noexcept
 Creates a new zero initialized SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (int32 xyzw) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (int32 x, int32 y, int32 z, int32 w) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (int32 x, int32 y, int32 z) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (i32x4 xyz, int32 w) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (u32x4 v)
 Creates a new SIMD 4 component 32bit floating point vector structure. (int4)
 
 i32x4 (int4 v) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (int3 v) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (int2 v) noexcept
 Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)
 
 i32x4 (const int32 *v) noexcept
 Creates a new SIMD 4 component vector 32bit signed integer structure. (int4)
 
void loadAligned (const int32 *v) noexcept
 Loads SIMD 4 component 32bit signed integer aligned vector values.
 
void store (int32 *v) noexcept
 Stores SIMD 4 component 32bit signed integer unaligned vector values.
 
void storeAligned (int32 *v) noexcept
 Stores SIMD 4 component 32bit signed integer aligned vector values.
 
int32 getX () const noexcept
 Returns SIMD vector first component value.
 
int32 getY () const noexcept
 Returns SIMD vector second component value.
 
int32 getZ () const noexcept
 Returns SIMD vector third component value.
 
int32 getW () const noexcept
 Returns SIMD vector fourth component value.
 
void setX (int32 value) noexcept
 Sets SIMD vector first component value.
 
void setY (int32 value) noexcept
 Sets SIMD vector second component value.
 
void setZ (int32 value) noexcept
 Sets SIMD vector third component value.
 
void setW (int32 value) noexcept
 Sets SIMD vector fourth component value.
 
void fixW () noexcept
 Sets SIMD vector Z component value to the W component.
 
template<uint32 X, uint32 Y, uint32 Z, uint32 W = SwU>
i32x4 swizzle () const noexcept
 Swizzles SIMD vector components.
 
i32x4 splatX () const noexcept
 
i32x4 splatY () const noexcept
 
i32x4 splatZ () const noexcept
 
i32x4 splatW () const noexcept
 
int32operator[] (psize i) noexcept
 Returns SIMD vector component by index.
 
int32 operator[] (psize i) const noexcept
 Returns SIMD vector component by index.
 
 operator u32x4 () const noexcept
 Returns as 4 component unsigned integer SIMD vector.
 
 operator int4 () const noexcept
 Returns SIMD vector as 4 component signed integer vector. (xyzw)
 
 operator int3 () const noexcept
 Returns SIMD vector as 3 component signed integer vector. (xyz)
 
 operator int2 () const noexcept
 Returns SIMD vector as 2 component signed integer vector. (xy)
 
 operator int32 () const noexcept
 Returns SIMD first vector component value. (x)
 
i32x4 operator+ (i32x4 v) const noexcept
 
i32x4 operator- (i32x4 v) const noexcept
 
i32x4 operator* (i32x4 v) const noexcept
 
i32x4 operator/ (i32x4 v) const noexcept
 
i32x4 operator% (i32x4 v) const noexcept
 
i32x4 operator& (i32x4 v) const noexcept
 
i32x4 operator| (i32x4 v) const noexcept
 
i32x4 operator^ (i32x4 v) const noexcept
 
i32x4 operator>> (i32x4 v) const noexcept
 
i32x4 operator<< (i32x4 v) const noexcept
 
i32x4 operator>> (int32 n) const noexcept
 
i32x4 operator<< (int32 n) const noexcept
 
i32x4 operator- () const noexcept
 
i32x4 operator! () const noexcept
 
i32x4 operator~ () const noexcept
 
i32x4 operator+ (int32 n) const noexcept
 
i32x4 operator- (int32 n) const noexcept
 
i32x4 operator* (int32 n) const noexcept
 
i32x4 operator/ (int32 n) const noexcept
 
i32x4 operator% (int32 n) const noexcept
 
i32x4 operator& (int32 n) const noexcept
 
i32x4 operator| (int32 n) const noexcept
 
i32x4 operator^ (int32 n) const noexcept
 
i32x4operator+= (i32x4 v) noexcept
 
i32x4operator-= (i32x4 v) noexcept
 
i32x4operator*= (i32x4 v) noexcept
 
i32x4operator/= (i32x4 v) noexcept
 
i32x4operator%= (i32x4 v) noexcept
 
i32x4operator&= (i32x4 v) noexcept
 
i32x4operator|= (i32x4 v) noexcept
 
i32x4operator^= (i32x4 v) noexcept
 
i32x4operator>>= (i32x4 v) noexcept
 
i32x4operator<<= (i32x4 v) noexcept
 
i32x4operator+= (int32 n) noexcept
 
i32x4operator-= (int32 n) noexcept
 
i32x4operator*= (int32 n) noexcept
 
i32x4operator/= (int32 n) noexcept
 
i32x4operator%= (int32 n) noexcept
 
i32x4operator&= (int32 n) noexcept
 
i32x4operator|= (int32 n) noexcept
 
i32x4operator^= (int32 n) noexcept
 
i32x4operator>>= (int32 n) noexcept
 
i32x4operator<<= (int32 n) noexcept
 
i32x4operator= (int32 n) noexcept
 
bool operator== (i32x4 v) const noexcept
 
bool operator!= (i32x4 v) const noexcept
 
u32x4 operator< (i32x4 v) const noexcept
 
u32x4 operator> (i32x4 v) const noexcept
 
u32x4 operator<= (i32x4 v) const noexcept
 
u32x4 operator>= (i32x4 v) const noexcept
 
bool operator== (int32 n) const noexcept
 
bool operator!= (int32 n) const noexcept
 
u32x4 operator< (int32 n) const noexcept
 
u32x4 operator> (int32 n) const noexcept
 
u32x4 operator<= (int32 n) const noexcept
 
u32x4 operator>= (int32 n) const noexcept
 

Public Attributes

union { 
 
_simd_i128 data
 
int4 ints
 
uint4 uints
 
float4 floats
 
};  
 

Static Public Attributes

static const i32x4 zero = i32x4(0)
 
static const i32x4 one = i32x4(1)
 
static const i32x4 minusOne = i32x4(-1)
 
static const i32x4 min = i32x4(INT32_MIN)
 
static const i32x4 max = i32x4(INT32_MAX)
 

Detailed Description

SIMD 4 component 32bit signed integer vector structure. (int4)

Note
Use it when you know how to implement a faster vectorized code.

Constructor & Destructor Documentation

◆ i32x4() [1/9]

i32x4 ( int32 xyzw)
inlineexplicitnoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
xyzwtarget value for all vector components

◆ i32x4() [2/9]

i32x4 ( int32 x,
int32 y,
int32 z,
int32 w )
inlinenoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
xfirst vector component value
ysecond vector component value
zthird vector component value
wfourth vector component value

◆ i32x4() [3/9]

i32x4 ( int32 x,
int32 y,
int32 z )
inlinenoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Warning
This constructor duplicates Z component to the W component!
Parameters
xfirst vector component value
ysecond vector component value
zthird vector component value

◆ i32x4() [4/9]

i32x4 ( i32x4 xyz,
int32 w )
inlinenoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
xyzfirst, second and third vector component values
wfourth vector component value

◆ i32x4() [5/9]

i32x4 ( u32x4 v)
inlineexplicit

Creates a new SIMD 4 component 32bit floating point vector structure. (int4)

Parameters
vtarget vector unsigned integer SIMD data

◆ i32x4() [6/9]

i32x4 ( int4 v)
inlineexplicitnoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
vtarget 4 component vector value

◆ i32x4() [7/9]

i32x4 ( int3 v)
inlineexplicitnoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
vtarget 3 component vector value

◆ i32x4() [8/9]

i32x4 ( int2 v)
inlineexplicitnoexcept

Creates a new SIMD 4 component 32bit signed integer vector structure. (int4)

Parameters
vtarget 2 component vector value

◆ i32x4() [9/9]

i32x4 ( const int32 * v)
inlineexplicitnoexcept

Creates a new SIMD 4 component vector 32bit signed integer structure. (int4)

Parameters
[in]vtarget 4 component vector value pointer (unaligned)

Member Function Documentation

◆ loadAligned()

void loadAligned ( const int32 * v)
inlinenoexcept

Loads SIMD 4 component 32bit signed integer aligned vector values.

Warning
Specified vector pointer must be aligned in the memory!!!
Parameters
[in]vtarget 4 component vector value pointer (aligned)

◆ store()

void store ( int32 * v)
inlinenoexcept

Stores SIMD 4 component 32bit signed integer unaligned vector values.

Parameters
[out]vtarget 4 component vector value pointer (unaligned)

◆ storeAligned()

void storeAligned ( int32 * v)
inlinenoexcept

Stores SIMD 4 component 32bit signed integer aligned vector values.

Warning
Specified vector pointer must be aligned in the memory!!!
Parameters
[out]vtarget 4 component vector value pointer (aligned)

◆ setX()

void setX ( int32 value)
inlinenoexcept

Sets SIMD vector first component value.

Parameters
valuetarget X vector component value

◆ setY()

void setY ( int32 value)
inlinenoexcept

Sets SIMD vector second component value.

Parameters
valuetarget Y vector component value

◆ setZ()

void setZ ( int32 value)
inlinenoexcept

Sets SIMD vector third component value.

Parameters
valuetarget Z vector component value

◆ setW()

void setW ( int32 value)
inlinenoexcept

Sets SIMD vector fourth component value.

Parameters
valuetarget W vector component value

◆ fixW()

void fixW ( )
inlinenoexcept

Sets SIMD vector Z component value to the W component.

Note
Usefull when you want to prevent SIMD division by zero.

◆ swizzle()

template<uint32 X, uint32 Y, uint32 Z, uint32 W = SwU>
i32x4 swizzle ( ) const
inlinenoexcept

Swizzles SIMD vector components.

Template Parameters
Xfirst vector component swizzle index
Ysecond vector component swizzle index
Zthird vector component swizzle index
Wfourth vector component swizzle index

◆ operator[]() [1/2]

int32 & operator[] ( psize i)
inlinenoexcept

Returns SIMD vector component by index.

Parameters
itarget component index

◆ operator[]() [2/2]

int32 operator[] ( psize i) const
inlinenoexcept

Returns SIMD vector component by index.

Parameters
itarget component index