Vector4f32 Class Reference

#include <sse_vector_4f32.h>

Detailed Description

The class and the default constructor are always defined. The functions of this class are only defined when C4D_HAS_SSE2_CAPABILITY is set. Instances of this class must be aligned to 16 bytes. The layout in the memory is as follows: address + 0 + 1 + 2 + 3 R0 R1 R2 R3

Public Types

using ValueType = Float32
 

Public Member Functions

 Vector4f32 ()=default
 
MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 (Float32 f, Bool setAll=true)
 
MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 (Float32 f0, Float32 f1, Float32 f2, Float32 f3)
 
MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 (const Float32 *p, Bool aligned)
 
MAXON_ATTRIBUTE_FORCE_INLINE void LoadUnaligned (const Float32 *p)
 
MAXON_ATTRIBUTE_FORCE_INLINE void LoadUnaligned (const Float64 *p)
 
MAXON_ATTRIBUTE_FORCE_INLINE void LoadAligned (const Float32 *p)
 
MAXON_ATTRIBUTE_FORCE_INLINE void LoadAligned (const Float64 *p)
 
MAXON_ATTRIBUTE_FORCE_INLINE void StoreUnaligned (Float32 *p) const
 
MAXON_ATTRIBUTE_FORCE_INLINE void StoreAligned (Float32 *p) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Float32operator[] (UInt i)
 
MAXON_ATTRIBUTE_FORCE_INLINE Float32 operator[] (UInt i) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32operator+= (const Vector4f32 &a)
 
MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Blend (const Vector4f32 &b, const Vector4f32 &mask) const
 

Static Public Member Functions

template<Int32 ma4, Int32 ma3, Int32 ma2, Int32 ma1>
static MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Shuffle (const Vector4f32 &a)
 
template<Int32 mb2, Int32 mb1, Int32 ma2, Int32 ma1>
static MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Shuffle (const Vector4f32 &a, const Vector4f32 &b)
 

Public Attributes

union {
   Float32   v [4]
 
}; 
 

Friends

Vector4f32 CastToVector4f32 (const Vector4i32 &a)
 
Vector4f32 ConvertToVector4f32 (const Vector4i32 &a)
 
Vector4i32 CastToVector4i32 (const Vector4f32 &a)
 
Vector4i32 ConvertToVector4i32 (const Vector4f32 &a)
 
Vector4f32 ConvertToVector4f32 (const Vector2f64 &a, const Vector2f64 &b)
 
Vector4f32 ConvertToVector4f32 (const Vector2f64 &a)
 
void ConvertToVectors2f64 (const Vector4f32 &a, Vector2f64 &result1, Vector2f64 &result2)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator+ (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator- (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator* (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator* (const Vector4f32 &a, const Float32 b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator/ (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Min (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Max (const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Clamp (const Vector4f32 &x, const Vector4f32 &a, const Vector4f32 &b)
 
MAXON_ATTRIBUTE_FORCE_INLINE friend void Transpose (Vector4f32 &a, Vector4f32 &b, Vector4f32 &c, Vector4f32 &d)
 

Member Typedef Documentation

◆ ValueType

using ValueType = Float32

Constructor & Destructor Documentation

◆ Vector4f32() [1/4]

Vector4f32 ( )
default

Constructs the object. It does not set a default value.

◆ Vector4f32() [2/4]

MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 ( Float32  f,
Bool  setAll = true 
)
explicit

Constructs the object and sets all values to f.

Parameters
[in]fThe value that is assigned to all vector elements.

◆ Vector4f32() [3/4]

MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 ( Float32  f0,
Float32  f1,
Float32  f2,
Float32  f3 
)
explicit

Constructs the object and sets all values to f0...f3.

Parameters
[in]f0The value that is assigned to vector element 0.
[in]f1The value that is assigned to vector element 1.
[in]f2The value that is assigned to vector element 2.
[in]f3The value that is assigned to vector element 3.

◆ Vector4f32() [4/4]

MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 ( const Float32 p,
Bool  aligned 
)
explicit

Constructs a vector from an address in the memory.

Parameters
[in]pThe address where the vector is loaded from.
[in]alignedShould be set to true, if p is known to be 16-byte aligned.

Member Function Documentation

◆ LoadUnaligned() [1/2]

MAXON_ATTRIBUTE_FORCE_INLINE void LoadUnaligned ( const Float32 p)

Loads a vector from an address in the memory.

Parameters
[in]pThe address where the vector is loaded from.

◆ LoadUnaligned() [2/2]

MAXON_ATTRIBUTE_FORCE_INLINE void LoadUnaligned ( const Float64 p)

Loads a vector from an address in the memory.

Parameters
[in]pThe address where the vector is loaded from.

◆ LoadAligned() [1/2]

MAXON_ATTRIBUTE_FORCE_INLINE void LoadAligned ( const Float32 p)

Loads a vector from an address in the memory.

Parameters
[in]pThe address where the vector is loaded from, must be 16-byte aligned.

◆ LoadAligned() [2/2]

MAXON_ATTRIBUTE_FORCE_INLINE void LoadAligned ( const Float64 p)

Loads a vector from an address in the memory.

Parameters
[in]pThe address where the vector is loaded from, must be 16-byte aligned.

◆ StoreUnaligned()

MAXON_ATTRIBUTE_FORCE_INLINE void StoreUnaligned ( Float32 p) const

Stores the contents of this vector to an address in the memory.

Parameters
[in]pThe address where the vector is to be stored, must be 16-byte aligned.

◆ StoreAligned()

MAXON_ATTRIBUTE_FORCE_INLINE void StoreAligned ( Float32 p) const

Stores the contents of this vector to an address in the memory.

Parameters
[in]pThe address where the vector is to be stored, must be 16-byte aligned.

◆ operator[]() [1/2]

Gets component i from the vector.

Parameters
[in]iThe index.
Returns
Vector element.

◆ operator[]() [2/2]

MAXON_ATTRIBUTE_FORCE_INLINE Float32 operator[] ( UInt  i) const

Gets component i from the vector.

Parameters
[in]iThe index.
Returns
Vector element.

◆ operator+=()

Adds a vector to this.

Parameters
[in]aThe vector to add.
Returns
A reference to this vector.

◆ Blend()

MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Blend ( const Vector4f32 b,
const Vector4f32 mask 
) const

Blends this vector with another one using a mask. For each vector element, the element of this vector is chosen if the mask element is zero, and the element of the B vector is chosen if the mask element has all bits set. If only some of the mask bits are set, the result is undefined.

Parameters
[in]bInput vector B.
[in]maskMask vector.
Returns
Vector with elements from this or b, depending on mask.

◆ Shuffle() [1/2]

static MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Shuffle ( const Vector4f32 a)
static

Shuffles the components of the input vector. Note that the template arguments must be numeric constants.

Parameters
[in]aInput vector.
Template Parameters
ma1Decides which element of vector A becomes the new R0.
ma2Decides which element of vector A becomes the new R1.
ma3Decides which element of vector A becomes the new R2.
ma4Decides which element of vector A becomes the new R3.
Returns
A vector consisting of R0=A[ma1], R1=A[ma2], R2=A[ma2], R3=A[ma3]

◆ Shuffle() [2/2]

static MAXON_ATTRIBUTE_FORCE_INLINE Vector4f32 Shuffle ( const Vector4f32 a,
const Vector4f32 b 
)
static

Shuffles the components of the input vectors. Note that the template arguments must be numeric constants and be 0 to 3.

Parameters
[in]aInput vector A.
[in]bInput vector B.
Template Parameters
ma1Decides which element of vector A becomes the new R0.
ma2Decides which element of vector A becomes the new R1.
mb1Decides which element of vector B becomes the new R2.
mb2Decides which element of vector B becomes the new R3.
Returns
A vector consisting of R0=A[ma1], R1=A[ma2], R2=B[mb1], R3=B[mb2]

Friends And Related Function Documentation

◆ CastToVector4f32

Vector4f32 CastToVector4f32 ( const Vector4i32 a)
friend

Casts a Vector4i32 to a Vector4f32 vector.

Returns
A Vector4f32 vector.

◆ ConvertToVector4f32 [1/3]

Vector4f32 ConvertToVector4f32 ( const Vector4i32 a)
friend

Converts a Vector4i32 to a Vector4f32 vector.

Returns
A Vector4f32 vector.

◆ CastToVector4i32

Vector4i32 CastToVector4i32 ( const Vector4f32 a)
friend

Casts a Vector4f32 to a Vector4i32 vector.

Returns
A Vector4i32 vector.

◆ ConvertToVector4i32

Vector4i32 ConvertToVector4i32 ( const Vector4f32 a)
friend

Converts a Vector4f32 to a Vector4i32 vector.

Returns
A Vector4i32 vector.

◆ ConvertToVector4f32 [2/3]

Vector4f32 ConvertToVector4f32 ( const Vector2f64 a,
const Vector2f64 b 
)
friend

Converts two Vector2f64 to a Vector4f32 vector.

Returns
A Vector4f32 vector.

◆ ConvertToVector4f32 [3/3]

Vector4f32 ConvertToVector4f32 ( const Vector2f64 a)
friend

Converts one Vector2f64 to a Vector4f32 vector.

Returns
A Vector4f32 vector. The two lower values are the converted members from the source vector, the two upper values are zero.

◆ ConvertToVectors2f64

void ConvertToVectors2f64 ( const Vector4f32 a,
Vector2f64 result1,
Vector2f64 result2 
)
friend

◆ operator+

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator+ ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Adds two vectors.

Parameters
[in]aThe first operand.
[in]bThe second operand.
Returns
The sum of a and b.

◆ operator-

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator- ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Subtracts two vectors.

Parameters
[in]aThe first operand.
[in]bThe second operand.
Returns
The component-by-component result of a - b.

◆ operator* [1/2]

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator* ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Multiplies two vectors.

Parameters
[in]aThe first operand.
[in]bThe second operand.
Returns
The product of a and b.

◆ operator* [2/2]

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator* ( const Vector4f32 a,
const Float32  b 
)
friend

Multiplies a Float32 with each vector component.

Parameters
[in]aThe first operand.
[in]bThe second operand.
Returns
The product of a and b.

◆ operator/

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 operator/ ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Divides two vectors.

Parameters
[in]aThe first operand.
[in]bThe second operand.
Returns
The component-by-component result of a / b.

◆ Min

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Min ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Calculates the minimum of two vectors.

Parameters
[in]aInput vector A.
[in]bInput vector B.
Returns
The component-by-component minimum of a and b.

◆ Max

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Max ( const Vector4f32 a,
const Vector4f32 b 
)
friend

Calculates the maximum of two vectors.

Parameters
[in]aInput vector A.
[in]bInput vector B.
Returns
The component-by-component maximum of a and b.

◆ Clamp

MAXON_ATTRIBUTE_FORCE_INLINE friend Vector4f32 Clamp ( const Vector4f32 x,
const Vector4f32 a,
const Vector4f32 b 
)
friend

Clamps all components of the input vector x to a and b.

Parameters
[in]xInput vector.
[in]aMinimum value.
[in]bMaximum value.
Returns
The component-by-component result.

◆ Transpose

MAXON_ATTRIBUTE_FORCE_INLINE friend void Transpose ( Vector4f32 a,
Vector4f32 b,
Vector4f32 c,
Vector4f32 d 
)
friend

Transposes the input vectors.

Parameters
[in,out]aInput / Output vector a.
[in,out]bInput / Output vector b.
[in,out]cInput / Output vector c.
[in,out]dInput / Output vector d.

Member Data Documentation

◆ v

Float32 v[4]

◆ 

union { ... }

The internal SSE vector.