HDK
|
Integer 4-vector, accelerated by SIMD instructions when available. More...
#include <simd.h>
Public Types | |
enum | { elements = 4 } |
enum | { paddedelements =4 } |
enum | { bits = 128 } |
typedef int | value_t |
Underlying equivalent scalar value type. More... | |
typedef simd_raw_t< int, elements >::type | simd_t |
the native SIMD type used More... | |
typedef vbool4 | vbool_t |
bool type of the same length More... | |
typedef vfloat4 | vfloat_t |
float type of the same length More... | |
typedef vint4 | vint_t |
int type of the same length More... | |
typedef vbool4 | bool_t |
typedef vfloat4 | float_t |
Public Member Functions | |
vint4 () | |
Default constructor (contents undefined) More... | |
vint4 (int a) | |
Construct from a single value (store it in all slots) More... | |
vint4 (int a, int b) | |
Construct from 2 values – (a,a,b,b) More... | |
vint4 (int a, int b, int c, int d) | |
Construct from 4 values. More... | |
vint4 (const int *vals) | |
Construct from a pointer to values. More... | |
vint4 (const unsigned short *vals) | |
Construct from a pointer to unsigned short values. More... | |
vint4 (const short *vals) | |
Construct from a pointer to signed short values. More... | |
vint4 (const unsigned char *vals) | |
Construct from a pointer to unsigned char values (0 - 255) More... | |
vint4 (const char *vals) | |
Construct from a pointer to signed char values (-128 - 127) More... | |
vint4 (const vint4 &other) | |
Copy construct from another vint4. More... | |
vint4 (const vfloat4 &f) | |
Convert a vfloat to an vint. Equivalent to i = (int)f;. More... | |
vint4 (const simd_t &m) | |
Construct from the underlying SIMD type. More... | |
operator simd_t () const | |
Return the raw SIMD type. More... | |
simd_t | simd () const |
simd_t & | simd () |
const value_t * | data () const |
Return a pointer to the underlying scalar type. More... | |
value_t * | data () |
void | clear () |
Sset all components to 0. More... | |
const vint4 & | operator= (int a) |
Assign one value to all components. More... | |
const vint4 & | operator= (const vint4 &other) |
Assignment from another vint4. More... | |
int | operator[] (int i) const |
Component access (get) More... | |
int & | operator[] (int i) |
Component access (set) More... | |
void | setcomp (int i, int value) |
Component access (set). More... | |
value_t | x () const |
value_t | y () const |
value_t | z () const |
value_t | w () const |
void | set_x (value_t val) |
void | set_y (value_t val) |
void | set_z (value_t val) |
void | set_w (value_t val) |
void | load (int a) |
Helper: load a single int into all components. More... | |
void | load (int a, int b, int c, int d) |
Helper: load separate values into each component. More... | |
void | load (const int *values) |
Load from an array of 4 values. More... | |
void | load (const int *values, int n) |
void | load (const unsigned short *values) |
Load from an array of 4 unsigned short values, convert to vint4. More... | |
void | load (const short *values) |
Load from an array of 4 unsigned short values, convert to vint4. More... | |
void | load (const unsigned char *values) |
Load from an array of 4 unsigned char values, convert to vint4. More... | |
void | load (const char *values) |
Load from an array of 4 unsigned char values, convert to vint4. More... | |
void | store (int *values) const |
Store the values into memory. More... | |
void | store (int *values, int n) const |
Store the first n values into memory. More... | |
void | store (unsigned short *values) const |
void | store (unsigned char *values) const |
void | load_mask (int mask, const value_t *values) |
void | load_mask (const vbool_t &mask, const value_t *values) |
void | store_mask (int mask, value_t *values) const |
void | store_mask (const vbool_t &mask, value_t *values) const |
template<int scale = 4> | |
void | gather (const value_t *baseptr, const vint_t &vindex) |
Load values from addresses (char*)basepatr + vindex[i]*scale. More... | |
template<int scale = 4> | |
void | gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex) |
Gather elements defined by the mask, leave others unchanged. More... | |
template<int scale = 4> | |
void | gather_mask (int mask, const value_t *baseptr, const vint_t &vindex) |
template<int scale = 4> | |
void | scatter (value_t *baseptr, const vint_t &vindex) const |
Store values at addresses (char*)basepatr + vindex[i]*scale. More... | |
template<int scale = 4> | |
void | scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const |
Scatter elements defined by the mask. More... | |
template<int scale = 4> | |
void | scatter_mask (int mask, value_t *baseptr, const vint_t &vindex) const |
template<int scale> | |
OIIO_FORCEINLINE void | gather (const value_t *baseptr, const vint_t &vindex) |
template<int scale> | |
OIIO_FORCEINLINE void | gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex) |
template<int scale> | |
OIIO_FORCEINLINE void | scatter (value_t *baseptr, const vint_t &vindex) const |
template<int scale> | |
OIIO_FORCEINLINE void | scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const |
Static Public Member Functions | |
static const char * | type_name () |
static const vint4 | Zero () |
Return an vint4 with all components set to 0. More... | |
static const vint4 | One () |
Return an vint4 with all components set to 1. More... | |
static const vint4 | NegOne () |
Return an vint4 with all components set to -1 (aka 0xffffffff) More... | |
static const vint4 | Iota (int start=0, int step=1) |
static const vint4 | Giota () |
Return an vint4 with "geometric" iota: (1, 2, 4, 8). More... | |
Integer 4-vector, accelerated by SIMD instructions when available.
typedef vbool4 simd::vint4::bool_t |
typedef vfloat4 simd::vint4::float_t |
typedef simd_raw_t<int,elements>::type simd::vint4::simd_t |
typedef int simd::vint4::value_t |
typedef vbool4 simd::vint4::vbool_t |
typedef vfloat4 simd::vint4::vfloat_t |
typedef vint4 simd::vint4::vint_t |
|
inline |
OIIO_FORCEINLINE simd::vint4::vint4 | ( | int | a | ) |
OIIO_FORCEINLINE simd::vint4::vint4 | ( | int | a, |
int | b | ||
) |
OIIO_FORCEINLINE simd::vint4::vint4 | ( | int | a, |
int | b, | ||
int | c, | ||
int | d | ||
) |
OIIO_FORCEINLINE simd::vint4::vint4 | ( | const int * | vals | ) |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
inline |
|
explicit |
|
inline |
OIIO_FORCEINLINE void simd::vint4::clear | ( | ) |
|
inline |
Load values from addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vint4::gather | ( | const value_t * | baseptr, |
const vint_t & | vindex | ||
) |
void simd::vint4::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
Gather elements defined by the mask, leave others unchanged.
void simd::vint4::gather_mask | ( | int | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
OIIO_FORCEINLINE void simd::vint4::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
|
static |
|
static |
OIIO_FORCEINLINE void simd::vint4::load | ( | int | a | ) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const int * | values | ) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const int * | values, |
int | n | ||
) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const unsigned short * | values | ) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const short * | values | ) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const unsigned char * | values | ) |
OIIO_FORCEINLINE void simd::vint4::load | ( | const char * | values | ) |
OIIO_FORCEINLINE void simd::vint4::load_mask | ( | int | mask, |
const value_t * | values | ||
) |
OIIO_FORCEINLINE void simd::vint4::load_mask | ( | const vbool_t & | mask, |
const value_t * | values | ||
) |
|
static |
|
static |
|
inline |
OIIO_FORCEINLINE const vint4 & simd::vint4::operator= | ( | int | a | ) |
OIIO_FORCEINLINE const vint4 & simd::vint4::operator= | ( | const vint4 & | other | ) |
OIIO_FORCEINLINE int simd::vint4::operator[] | ( | int | i | ) | const |
OIIO_FORCEINLINE int & simd::vint4::operator[] | ( | int | i | ) |
void simd::vint4::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
Store values at addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vint4::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
void simd::vint4::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
Scatter elements defined by the mask.
void simd::vint4::scatter_mask | ( | int | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
OIIO_FORCEINLINE void simd::vint4::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
OIIO_FORCEINLINE void simd::vint4::set_w | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vint4::set_x | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vint4::set_y | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vint4::set_z | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vint4::setcomp | ( | int | i, |
int | value | ||
) |
OIIO_FORCEINLINE void simd::vint4::store | ( | int * | values | ) | const |
OIIO_FORCEINLINE void simd::vint4::store | ( | int * | values, |
int | n | ||
) | const |
OIIO_FORCEINLINE void simd::vint4::store | ( | unsigned short * | values | ) | const |
OIIO_FORCEINLINE void simd::vint4::store | ( | unsigned char * | values | ) | const |
OIIO_FORCEINLINE void simd::vint4::store_mask | ( | int | mask, |
value_t * | values | ||
) | const |
OIIO_FORCEINLINE void simd::vint4::store_mask | ( | const vbool_t & | mask, |
value_t * | values | ||
) | const |
OIIO_FORCEINLINE int simd::vint4::w | ( | ) | const |
OIIO_FORCEINLINE int simd::vint4::x | ( | ) | const |
OIIO_FORCEINLINE int simd::vint4::y | ( | ) | const |
OIIO_FORCEINLINE int simd::vint4::z | ( | ) | const |
|
static |
|
friend |