Om
1.0.0
A universal framework for multimedia simulation
|
A class representing a 4-component 32-bit floating-point SIMD scalar. More...
#include <omSIMDScalarFloat32_4.h>
Public Member Functions | |
SIMDScalar () | |
Define the type for a 4x float scalar structure. More... | |
SIMDScalar (Float32 value) | |
Create a new 4D SIMD scalar with all elements equal to the specified value. More... | |
SIMDScalar (Float32 newA, Float32 newB, Float32 newC, Float32 newD) | |
Create a new 4D SIMD scalar with the elements equal to the specified 4 values. More... | |
SIMDScalar (const VectorND< Float32, 3 > &vector) | |
Create a new 4D SIMD scalar with the first 3 elements equal to the specified vector's components. More... | |
SIMDScalar (const VectorND< Float32, 4 > &vector) | |
Create a new 4D SIMD scalar with the elements equal to the specified vector's components. More... | |
SIMDScalar (const Float32 *array) | |
Create a new 4D SIMD scalar from the first 4 values stored at specified aligned pointer's location. More... | |
SIMDScalar (const SIMDScalar &other) | |
Create a new SIMD scalar with the same contents as another. More... | |
SIMDScalar & | operator= (const SIMDScalar &other) |
Assign the contents of one SIMDScalar object to another. More... | |
void | store (Float32 *destination) const |
void | storeUnaligned (Float32 *destination) const |
Float32 & | operator[] (Index i) |
Get a reference to the value stored at the specified component index in this scalar. More... | |
Float32 | operator[] (Index i) const |
Get the value stored at the specified component index in this scalar. More... | |
const Float32 * | toArray () const |
Get a pointer to the first element in this scalar. More... | |
operator VectorND< Float32, 3 > () const | |
Convert this scalar to a 3D vector using the first 3 components. More... | |
operator VectorND< Float32, 4 > () const | |
Convert this scalar to a 4D vector. More... | |
SIMDScalar< Int32, 4 > | operator== (const SIMDScalar &scalar) const |
Compare two 4D SIMD scalars component-wise for equality. More... | |
SIMDScalar< Int32, 4 > | operator== (const Float32 value) const |
Compare this scalar to a single floating point value for equality. More... | |
SIMDScalar< Int32, 4 > | operator!= (const SIMDScalar &scalar) const |
Compare two 4D SIMD scalars component-wise for inequality. More... | |
SIMDScalar< Int32, 4 > | operator!= (const Float32 value) const |
Compare this scalar to a single floating point value for inequality. More... | |
SIMDScalar< Int32, 4 > | operator< (const SIMDScalar &scalar) const |
Perform a component-wise less-than comparison between this an another 4D SIMD scalar. More... | |
SIMDScalar< Int32, 4 > | operator< (const Float32 value) const |
Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. More... | |
SIMDScalar< Int32, 4 > | operator> (const SIMDScalar &scalar) const |
Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. More... | |
SIMDScalar< Int32, 4 > | operator> (const Float32 value) const |
Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. More... | |
SIMDScalar< Int32, 4 > | operator<= (const SIMDScalar &scalar) const |
Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. More... | |
SIMDScalar< Int32, 4 > | operator<= (const Float32 value) const |
Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More... | |
SIMDScalar< Int32, 4 > | operator>= (const SIMDScalar &scalar) const |
Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. More... | |
SIMDScalar< Int32, 4 > | operator>= (const Float32 value) const |
Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More... | |
SIMDScalar | sum () const |
Return the horizontal sum of this 4D SIMD scalar. More... | |
Float32 | sumScalar () const |
Return the horizontal sum of this 4D SIMD scalar. More... | |
SIMDScalar | operator- () const |
Negate a scalar. More... | |
SIMDScalar | operator+ (const SIMDScalar &scalar) const |
Add this scalar to another and return the result. More... | |
SIMDScalar | operator+ (const Float32 value) const |
Add a value to every component of this scalar. More... | |
SIMDScalar | operator- (const SIMDScalar &scalar) const |
Subtract a scalar from this scalar component-wise and return the result. More... | |
SIMDScalar | operator- (const Float32 value) const |
Subtract a value from every component of this scalar. More... | |
SIMDScalar | operator* (const SIMDScalar &scalar) const |
Multiply component-wise this scalar and another scalar. More... | |
SIMDScalar | operator* (const Float32 value) const |
Multiply every component of this scalar by a value and return the result. More... | |
SIMDScalar | operator/ (const SIMDScalar &scalar) const |
Divide this scalar by another scalar component-wise. More... | |
SIMDScalar | operator/ (const Float32 value) const |
Divide every component of this scalar by a value and return the result. More... | |
SIMDScalar & | operator+= (const SIMDScalar &scalar) |
Add a scalar to this scalar, modifying this original scalar. More... | |
SIMDScalar & | operator-= (const SIMDScalar &scalar) |
Subtract a scalar from this scalar, modifying this original scalar. More... | |
SIMDScalar & | operator*= (const SIMDScalar &scalar) |
Multiply component-wise this scalar and another scalar and modify this scalar. More... | |
SIMDScalar & | operator/= (const SIMDScalar &scalar) |
Divide this scalar by another scalar component-wise and modify this scalar. More... | |
data::String | toString () const |
Convert this SIMD scalar into a human-readable string representation. More... | |
operator data::String () const | |
Convert this SIMD scalar into a human-readable string representation. More... | |
Static Public Member Functions | |
static SIMDScalar | load (const Float32 *array) |
static SIMDScalar | loadUnaligned (const Float32 *array) |
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... | |
static Bool | isSupported () |
Return whether or not this SIMD type is supported by the current CPU. More... | |
Friends | |
SIMDScalar | reciprocal (const SIMDScalar &scalar) |
SIMDScalar | reciprocalSqrt (const SIMDScalar &scalar) |
SIMDScalar | abs (const SIMDScalar &scalar) |
SIMDScalar | ceiling (const SIMDScalar &scalar) |
SIMDScalar | floor (const SIMDScalar &scalar) |
SIMDScalar | sqrt (const SIMDScalar &scalar) |
SIMDScalar | min (const SIMDScalar &scalar1, const SIMDScalar &scalar2) |
SIMDScalar | max (const SIMDScalar &scalar1, const SIMDScalar &scalar2) |
SIMDScalar | ln (const SIMDScalar &scalar) |
SIMDScalar | log10 (const SIMDScalar &scalar) |
SIMDScalar | sin (const SIMDScalar &scalar) |
SIMDScalar | cos (const SIMDScalar &scalar) |
template<UInt i1, UInt i2, UInt i3, UInt i4> | |
SIMDScalar< Float32, 4 > | shuffle (const SIMDScalar< Float32, 4 > &scalar1) |
Pick 4 elements from the specified SIMD scalar and return the result. More... | |
template<UInt i1, UInt i2, UInt i3, UInt i4> | |
SIMDScalar< Float32, 4 > | shuffle (const SIMDScalar< Float32, 4 > &scalar1, const SIMDScalar< Float32, 4 > &scalar2) |
Pick two elements from each SIMD scalar and return the result. More... | |
SIMDScalar< Float32, 4 > | select (const SIMDScalar< Int32, 4 > &selector, const SIMDScalar< Float32, 4 > &scalar1, const SIMDScalar< Float32, 4 > &scalar2) |
Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. More... | |
SIMDScalar | lows (const SIMDScalar &scalar) |
SIMDScalar | highs (const SIMDScalar &scalar) |
SIMDScalar | subAdd (const SIMDScalar &scalar1, const SIMDScalar &scalar2) |
A class representing a 4-component 32-bit floating-point SIMD scalar.
This specialization of the SIMDScalar class uses a 128-bit value to encode 4 32-bit floating-point values. All basic arithmetic operations are supported, plus a subset of standard scalar operations: abs(), min(), max(), sqrt().
|
inline |
Define the type for a 4x float scalar structure.
Create a new 4D SIMD scalar with all elements left uninitialized.
|
inline |
Create a new 4D SIMD scalar with all elements equal to the specified value.
|
inline |
Create a new 4D SIMD scalar with the elements equal to the specified 4 values.
|
inline |
Create a new 4D SIMD scalar with the first 3 elements equal to the specified vector's components.
The last element of the SIMD scalar is initialized to 0.
|
inline |
Create a new 4D SIMD scalar with the elements equal to the specified vector's components.
|
inlineexplicit |
Create a new 4D SIMD scalar from the first 4 values stored at specified aligned pointer's location.
|
inline |
Create a new SIMD scalar with the same contents as another.
This shouldn't have to be overloaded, but for some reason the compiler (GCC) optimizes SIMD code better with it overloaded. Before, the compiler would store the result of a SIMD operation on the stack before transfering it to the destination, resulting in an extra 8+ load/stores per computation.
|
inline |
Assign the contents of one SIMDScalar object to another.
This shouldn't have to be overloaded, but for some reason the compiler (GCC) optimizes SIMD code better with it overloaded. Before, the compiler would store the result of a SIMD operation on the stack before transfering it to the destination, resulting in an extra 8+ load/stores per computation.
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
Get a reference to the value stored at the specified component index in this scalar.
|
inline |
Get the value stored at the specified component index in this scalar.
|
inline |
Get a pointer to the first element in this scalar.
The remaining values are in the next 3 locations after the first element.
|
inline |
Convert this scalar to a 3D vector using the first 3 components.
|
inline |
Convert this scalar to a 4D vector.
|
inline |
Compare two 4D SIMD scalars component-wise for equality.
Return a 4D scalar of integers 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.
|
inline |
Compare this scalar to a single floating point value for equality.
Return a 4D scalar of integers 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.
|
inline |
Compare two 4D SIMD scalars component-wise for inequality.
Return a 4D scalar of integers 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.
|
inline |
Compare this scalar to a single floating point value for inequality.
Return a 4D scalar of integers 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.
|
inline |
Perform a component-wise less-than comparison between this an another 4D SIMD scalar.
Return a 4D scalar of integers 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.
|
inline |
Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar.
Return a 4D scalar of integers 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.
|
inline |
Perform a component-wise greater-than comparison between this an another 4D SIMD scalar.
Return a 4D scalar of integers 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.
|
inline |
Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar.
Return a 4D scalar of integers 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.
|
inline |
Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar.
Return a 4D scalar of integers 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.
|
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 integers 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.
|
inline |
Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar.
Return a 4D scalar of integers 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.
|
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 integers 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.
|
inline |
Return the horizontal sum of this 4D SIMD scalar.
|
inline |
Return the horizontal sum of this 4D SIMD scalar.
|
inline |
Negate a scalar.
This method negates every component of this 4D SIMD scalar and returns the result, leaving this scalar unmodified.
|
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.
scalar | - The scalar to add to this one. |
|
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.
value | - The value to add to all components of this scalar. |
|
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.
scalar | - The scalar to subtract from this one. |
|
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.
value | - The value to subtract from all components of this scalar. |
|
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.
scalar | - The scalar to multiply this scalar by. |
|
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.
value | - The value to multiplly with all components of this scalar. |
|
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.
scalar | - The scalar to multiply this scalar by. |
|
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.
value | - The value to divide all components of this scalar by. |
|
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.
scalar | - The scalar to add to this 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.
scalar | - The scalar to subtract from this 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.
scalar | - The scalar to multiply this scalar by. |
|
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.
scalar | - The scalar to divide this scalar by. |
|
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.
|
inlinestatic |
Get the width of this scalar (number of components it has).
|
inlinestatic |
Return whether or not this SIMD type is supported by the current CPU.
|
inline |
Convert this SIMD scalar into a human-readable string representation.
|
inline |
Convert this SIMD scalar into a human-readable string representation.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Pick 4 elements from the specified SIMD scalar and return the result.
|
friend |
Pick two elements from each SIMD scalar and return the result.
|
friend |
Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second.
|
friend |
|
friend |
|
friend |
Float32 om::math::SIMDScalar< Float32, 4 >::a |
The A component of a 4D SIMD scalar.
Float32 om::math::SIMDScalar< Float32, 4 >::b |
The B component of a 4D SIMD scalar.
Float32 om::math::SIMDScalar< Float32, 4 >::c |
The C component of a 4D SIMD scalar.
Float32 om::math::SIMDScalar< Float32, 4 >::d |
The D component of a 4D SIMD scalar.
Float32 om::math::SIMDScalar< Float32, 4 >::x[4] |
The components of a 4D SIMD scalar in array format.