Vc
1.3.2-dev
SIMD Vector Classes for C++
|
|
Wraps a pointer to memory with convenience functions to access it via vectors.
S | The type of the struct. |
V | The type of the vector to be returned when read. This should reflect the type of the members inside the struct. |
Definition at line 177 of file interleavedmemory.h.
#include <Vc/Memory>
Public Member Functions | |
InterleavedMemoryWrapper (S *s) | |
Constructs the wrapper object. More... | |
template<typename IT > | |
enable_if< std::is_convertible< IT, IndexType >::value &&!std::is_const< S >::value, Access > | operator[] (IT indexes) |
Interleaved scatter/gather access. More... | |
ReadAccess | operator[] (IndexType indexes) const |
const overload (gathers only) of the above function | |
ReadAccess | gather (IndexType indexes) const |
alias of the above function | |
ReadSuccessiveEntries | operator[] (size_t first) const |
Interleaved access. More... | |
|
inline |
Constructs the wrapper object.
s | A pointer to a C-array. |
Definition at line 202 of file interleavedmemory.h.
|
inline |
Interleaved scatter/gather access.
Assuming you have a struct of floats and a vector of indexes
into the array, this function can be used to access the struct entries as vectors using the minimal number of store or load instructions.
indexes | Vector of indexes that determine the gather locations. |
Example:
You may think of the gather operation (or scatter as the inverse) like this:
Memory: {x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 x5 y5 z5 x6 y6 z6 x7 y7 z7 x8 y8 z8} indexes: [5, 0, 1, 7] Result in (x, y, z): ({x5 x0 x1 x7}, {y5 y0 y1 y7}, {z5 z0 z1 z7})
\warning If \p indexes contains non-unique entries on scatter, the result is undefined. If \c NDEBUG is not defined the implementation will assert that the \p indexes entries are unique.
Definition at line 262 of file interleavedmemory.h.
|
inline |
Interleaved access.
This function is an optimization of the function above, for cases where the index vector contains consecutive values. It will load V::Size
consecutive entries from memory and deinterleave them into Vc vectors.
first | The first of V::Size indizes to be accessed. |
Example:
Definition at line 309 of file interleavedmemory.h.