Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Member Functions | Friends | List of all members
om::math::SIMDArray< Int32, width > Class Template Reference

A class representing an N-component 32-bit signed-integer SIMD scalar. More...

#include <omSIMDArrayInt32.h>

Public Member Functions

 SIMDArray ()
 Create a new SIMD scalar with all elements left uninitialized. More...
 
 SIMDArray (Int32 value)
 Create a new SIMD scalar with all elements equal to the specified value. More...
 
 SIMDArray (const Int32 *array)
 Create a new SIMD scalar from the first N values stored at specified pointer's location. More...
 
void store (Int32 *destination) const
 Store this SIMD scalar starting at the specified destination pointer. More...
 
void storeUnaligned (Int32 *destination) const
 Store this SIMD scalar starting at the specified unaligned destination pointer. More...
 
Int32operator[] (Index i)
 Get a reference to the value stored at the specified component index in this scalar. More...
 
Int32 operator[] (Index i) const
 Get the value stored at the specified component index in this scalar. More...
 
const Int32toArray () const
 Get a pointer to the first element in this scalar. More...
 
 operator Bool () const
 Return whether or not any component of this array has the high-order bit set. More...
 
Bool testMaskAny () const
 Return whether or not any component of this array has the high-order bit set. More...
 
Bool testMaskAll () const
 Return whether or not all components of this array have the high-order bit set. More...
 
SIMDArray operator~ () const
 Return the bitwise NOT of this 4D SIMD vector. More...
 
SIMDArray operator& (const SIMDArray &scalar) const
 Compute the bitwise AND of this 4D SIMD vector with another and return the result. More...
 
SIMDArray operator| (const SIMDArray &scalar) const
 Compute the bitwise OR of this 4D SIMD vector with another and return the result. More...
 
SIMDArray operator^ (const SIMDArray &scalar) const
 Compute the bitwise XOR of this 4D SIMD vector with another and return the result. More...
 
SIMDArrayoperator&= (const SIMDArray &scalar)
 Compute the logical AND of this 4D SIMD vector with another and assign it to this vector. More...
 
SIMDArrayoperator|= (const SIMDArray &scalar)
 Compute the logical OR of this 4D SIMD vector with another and assign it to this vector. More...
 
SIMDArrayoperator^= (const SIMDArray &scalar)
 Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector. More...
 
SIMDArray< Int32, width > operator== (const SIMDArray &scalar) const
 Compare two 4D SIMD scalars component-wise for equality. More...
 
SIMDArray< Int32, width > operator== (const Int32 value) const
 Compare this scalar to a single value for equality. More...
 
SIMDArray< Int32, width > operator!= (const SIMDArray &scalar) const
 Compare two 4D SIMD scalars component-wise for inequality. More...
 
SIMDArray< Int32, width > operator!= (const Int32 value) const
 Compare this scalar to a single floating point value for inequality. More...
 
SIMDArray< Int32, width > operator< (const SIMDArray &scalar) const
 Perform a component-wise less-than comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator< (const Int32 value) const
 Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator> (const SIMDArray &scalar) const
 Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator> (const Int32 value) const
 Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator<= (const SIMDArray &scalar) const
 Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator<= (const Int32 value) const
 Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator>= (const SIMDArray &scalar) const
 Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator>= (const Int32 value) const
 Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray operator<< (Int bitShift) const
 Shift each component of the SIMD scalar to the left by the specified amount of bits. More...
 
SIMDArray operator>> (Int bitShift) const
 Shift each component of the SIMD scalar to the right by the specified amount of bits. More...
 
SIMDArray operator- () const
 Negate a scalar. More...
 
SIMDArray operator+ (const SIMDArray &scalar) const
 Add this scalar to another and return the result. More...
 
SIMDArray operator+ (const Int32 value) const
 Add a value to every component of this scalar. More...
 
SIMDArray operator- (const SIMDArray &scalar) const
 Subtract a scalar from this scalar component-wise and return the result. More...
 
SIMDArray operator- (const Int32 value) const
 Subtract a value from every component of this scalar. More...
 
SIMDArray operator* (const SIMDArray &scalar) const
 Multiply component-wise this scalar and another scalar. More...
 
SIMDArray operator* (const Int32 value) const
 Multiply every component of this scalar by a value and return the result. More...
 
SIMDArray operator/ (const SIMDArray &scalar) const
 Divide this scalar by another scalar component-wise. More...
 
SIMDArray operator/ (const Int32 value) const
 Divide every component of this scalar by a value and return the result. More...
 
SIMDArrayoperator+= (const SIMDArray &scalar)
 Add a scalar to this scalar, modifying this original scalar. More...
 
SIMDArrayoperator-= (const SIMDArray &scalar)
 Subtract a scalar from this scalar, modifying this original scalar. More...
 
SIMDArrayoperator*= (const SIMDArray &scalar)
 Multiply component-wise this scalar and another scalar and modify this scalar. More...
 
SIMDArrayoperator/= (const SIMDArray &scalar)
 Divide this scalar by another scalar component-wise and modify this scalar. More...
 
data::String toString () const
 Convert this SIMD array into a human-readable string representation. More...
 
 operator data::String () const
 Convert this SIMD array into a human-readable string representation. More...
 

Static Public Member Functions

static SIMDArray load (const Int32 *array)
 Load a SIMD array from the specified aligned pointer to values. More...
 
static SIMDArray loadUnaligned (const Int32 *array)
 Load a SIMD array from the specified unaligned pointer to values. More...
 
static Size getAlignment ()
 Return the alignment required for objects of this type. More...
 
static Size getWidth ()
 Get the width of this scalar (number of components it has). More...
 

Friends

template<Size width2>
SIMDArray< Int32, width2 > abs (const SIMDArray< Int32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Int32, width2 > sqrt (const SIMDArray< Int32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Int32, width2 > min (const SIMDArray< Int32, width2 > &scalar1, const SIMDArray< Int32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Int32, width2 > max (const SIMDArray< Int32, width2 > &scalar1, const SIMDArray< Int32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Int32, width2 > select (const SIMDArray< Int32, width2 > &selector, const SIMDArray< Int32, width2 > &scalar1, const SIMDArray< Int32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Float32, width2 > select (const SIMDArray< Int32, width2 > &selector, const SIMDArray< Float32, width2 > &scalar1, const SIMDArray< Float32, width2 > &scalar2)
 

Detailed Description

template<Size width>
class om::math::SIMDArray< Int32, width >

A class representing an N-component 32-bit signed-integer SIMD scalar.

This specialization of the SIMDScalar class uses one or more 4-component SIMD values to simulate an N-wide SIMD register.

Constructor & Destructor Documentation

template<Size width>
om::math::SIMDArray< Int32, width >::SIMDArray ( )
inline

Create a new SIMD scalar with all elements left uninitialized.

template<Size width>
om::math::SIMDArray< Int32, width >::SIMDArray ( Int32  value)
inline

Create a new SIMD scalar with all elements equal to the specified value.

template<Size width>
om::math::SIMDArray< Int32, width >::SIMDArray ( const Int32 array)
inline

Create a new SIMD scalar from the first N values stored at specified pointer's location.

Member Function Documentation

template<Size width>
static SIMDArray om::math::SIMDArray< Int32, width >::load ( const Int32 array)
inlinestatic

Load a SIMD array from the specified aligned pointer to values.

template<Size width>
static SIMDArray om::math::SIMDArray< Int32, width >::loadUnaligned ( const Int32 array)
inlinestatic

Load a SIMD array from the specified unaligned pointer to values.

template<Size width>
void om::math::SIMDArray< Int32, width >::store ( Int32 destination) const
inline

Store this SIMD scalar starting at the specified destination pointer.

template<Size width>
void om::math::SIMDArray< Int32, width >::storeUnaligned ( Int32 destination) const
inline

Store this SIMD scalar starting at the specified unaligned destination pointer.

template<Size width>
Int32& om::math::SIMDArray< Int32, width >::operator[] ( Index  i)
inline

Get a reference to the value stored at the specified component index in this scalar.

template<Size width>
Int32 om::math::SIMDArray< Int32, width >::operator[] ( Index  i) const
inline

Get the value stored at the specified component index in this scalar.

template<Size width>
const Int32* om::math::SIMDArray< Int32, width >::toArray ( ) const
inline

Get a pointer to the first element in this scalar.

The remaining values are in the next 3 locations after the first element.

template<Size width>
om::math::SIMDArray< Int32, width >::operator Bool ( ) const
inline

Return whether or not any component of this array has the high-order bit set.

template<Size width>
Bool om::math::SIMDArray< Int32, width >::testMaskAny ( ) const
inline

Return whether or not any component of this array has the high-order bit set.

template<Size width>
Bool om::math::SIMDArray< Int32, width >::testMaskAll ( ) const
inline

Return whether or not all components of this array have the high-order bit set.

template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator~ ( ) const
inline

Return the bitwise NOT of this 4D SIMD vector.

template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator& ( const SIMDArray< Int32, width > &  scalar) const
inline

Compute the bitwise AND of this 4D SIMD vector with another and return the result.

template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator| ( const SIMDArray< Int32, width > &  scalar) const
inline

Compute the bitwise OR of this 4D SIMD vector with another and return the result.

template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator^ ( const SIMDArray< Int32, width > &  scalar) const
inline

Compute the bitwise XOR of this 4D SIMD vector with another and return the result.

template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator&= ( const SIMDArray< Int32, width > &  scalar)
inline

Compute the logical AND of this 4D SIMD vector with another and assign it to this vector.

template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator|= ( const SIMDArray< Int32, width > &  scalar)
inline

Compute the logical OR of this 4D SIMD vector with another and assign it to this vector.

template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator^= ( const SIMDArray< Int32, width > &  scalar)
inline

Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator== ( const SIMDArray< Int32, width > &  scalar) const
inline

Compare two 4D SIMD scalars component-wise for equality.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components is equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator== ( const Int32  value) const
inline

Compare this scalar to a single value for equality.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components is equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator!= ( const SIMDArray< Int32, width > &  scalar) const
inline

Compare two 4D SIMD scalars component-wise for inequality.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components is not equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator!= ( const Int32  value) const
inline

Compare this scalar to a single floating point value for inequality.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components is not equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator< ( const SIMDArray< Int32, width > &  scalar) const
inline

Perform a component-wise less-than comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component less than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator< ( const Int32  value) const
inline

Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component less than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator> ( const SIMDArray< Int32, width > &  scalar) const
inline

Perform a component-wise greater-than comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component greater than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator> ( const Int32  value) const
inline

Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component greater than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator<= ( const SIMDArray< Int32, width > &  scalar) const
inline

Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component less than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator<= ( const Int32  value) const
inline

Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component less than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator>= ( const SIMDArray< Int32, width > &  scalar) const
inline

Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component greater than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Int32, width >::operator>= ( const Int32  value) const
inline

Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component greater than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator<< ( Int  bitShift) const
inline

Shift each component of the SIMD scalar to the left by the specified amount of bits.

This method shifts the contents of each component to the left by the specified amount of bits and inserts zeros.

Parameters
bitShift- the number of bits to shift this SIMD scalar by.
Returns
the shifted SIMD scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator>> ( Int  bitShift) const
inline

Shift each component of the SIMD scalar to the right by the specified amount of bits.

This method shifts the contents of each component to the right by the specified amount of bits and sign extends the original values..

Parameters
bitShift- the number of bits to shift this SIMD scalar by.
Returns
the shifted SIMD scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator- ( ) const
inline

Negate a scalar.

This method negates every component of this 4D SIMD scalar and returns the result, leaving this scalar unmodified.

Returns
the negation of the original scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator+ ( const SIMDArray< Int32, width > &  scalar) const
inline

Add this scalar to another and return the result.

This method adds another scalar to this one, component-wise, and returns this addition. It does not modify either of the original scalars.

Parameters
scalar- The scalar to add to this one.
Returns
The addition of this scalar and the parameter.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator+ ( const Int32  value) const
inline

Add a value to every component of this scalar.

This method adds the value parameter to every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to add to all components of this scalar.
Returns
The resulting scalar of this addition.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator- ( const SIMDArray< Int32, width > &  scalar) const
inline

Subtract a scalar from this scalar component-wise and return the result.

This method subtracts another scalar from this one, component-wise, and returns this subtraction. It does not modify either of the original scalars.

Parameters
scalar- The scalar to subtract from this one.
Returns
The subtraction of the the parameter from this scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator- ( const Int32  value) const
inline

Subtract a value from every component of this scalar.

This method subtracts the value parameter from every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to subtract from all components of this scalar.
Returns
The resulting scalar of this subtraction.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator* ( const SIMDArray< Int32, width > &  scalar) const
inline

Multiply component-wise this scalar and another scalar.

This operator multiplies each component of this scalar by the corresponding component of the other scalar and returns a scalar representing this result. It does not modify either original scalar.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
The result of the multiplication.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator* ( const Int32  value) const
inline

Multiply every component of this scalar by a value and return the result.

This method multiplies the value parameter with every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to multiplly with all components of this scalar.
Returns
The resulting scalar of this multiplication.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator/ ( const SIMDArray< Int32, width > &  scalar) const
inline

Divide this scalar by another scalar component-wise.

This operator divides each component of this scalar by the corresponding component of the other scalar and returns a scalar representing this result. It does not modify either original scalar.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
The result of the division.
template<Size width>
SIMDArray om::math::SIMDArray< Int32, width >::operator/ ( const Int32  value) const
inline

Divide every component of this scalar by a value and return the result.

This method Divides every component of the scalar by the value parameter, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to divide all components of this scalar by.
Returns
The resulting scalar of this division.
template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator+= ( const SIMDArray< Int32, width > &  scalar)
inline

Add a scalar to this scalar, modifying this original scalar.

This method adds another scalar to this scalar, component-wise, and sets this scalar to have the result of this addition.

Parameters
scalar- The scalar to add to this scalar.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator-= ( const SIMDArray< Int32, width > &  scalar)
inline

Subtract a scalar from this scalar, modifying this original scalar.

This method subtracts another scalar from this scalar, component-wise, and sets this scalar to have the result of this subtraction.

Parameters
scalar- The scalar to subtract from this scalar.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator*= ( const SIMDArray< Int32, width > &  scalar)
inline

Multiply component-wise this scalar and another scalar and modify this scalar.

This operator multiplies each component of this scalar by the corresponding component of the other scalar and modifies this scalar to contain the result.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Int32, width >::operator/= ( const SIMDArray< Int32, width > &  scalar)
inline

Divide this scalar by another scalar component-wise and modify this scalar.

This operator divides each component of this scalar by the corresponding component of the other scalar and modifies this scalar to contain the result.

Parameters
scalar- The scalar to divide this scalar by.
Returns
A reference to this modified scalar.
template<Size width>
static Size om::math::SIMDArray< Int32, width >::getAlignment ( )
inlinestatic

Return the alignment required for objects of this type.

For most SIMD types this value will be 16 bytes. If there is no alignment required, 0 is returned.

template<Size width>
static Size om::math::SIMDArray< Int32, width >::getWidth ( )
inlinestatic

Get the width of this scalar (number of components it has).

template<Size width>
data::String om::math::SIMDArray< Int32, width >::toString ( ) const
inline

Convert this SIMD array into a human-readable string representation.

template<Size width>
om::math::SIMDArray< Int32, width >::operator data::String ( ) const
inline

Convert this SIMD array into a human-readable string representation.

Friends And Related Function Documentation

template<Size width>
template<Size width2>
SIMDArray<Int32,width2> abs ( const SIMDArray< Int32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Int32,width2> sqrt ( const SIMDArray< Int32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Int32,width2> min ( const SIMDArray< Int32, width2 > &  scalar1,
const SIMDArray< Int32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Int32,width2> max ( const SIMDArray< Int32, width2 > &  scalar1,
const SIMDArray< Int32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Int32,width2> select ( const SIMDArray< Int32, width2 > &  selector,
const SIMDArray< Int32, width2 > &  scalar1,
const SIMDArray< Int32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> select ( const SIMDArray< Int32, width2 > &  selector,
const SIMDArray< Float32, width2 > &  scalar1,
const SIMDArray< Float32, width2 > &  scalar2 
)
friend

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