simdpp::store_first

From libsimdpp-docs
< mem
template<unsigned N, class V>
void store_first( void* ptr, const any_vec<N,V>& a, unsigned n );

Stores the first n elements the given vector to memory block starting at ptr. n must be in range [0..N].

The function may be implemented as read-modify-write operation that behaves as if store(ptr, blend(a, (V) load(ptr), store_mask) was executed.

The function is meant to be used in loop tails. It results in several instructions and is best not used in inner loops.

V must me a non-mask vector type. ptr must be aligned to vector size.

Parameters[edit]

ptr - pointer to location to store data to
a - vector to store
n - the number of elements to store

Return value[edit]

(none)

Equivalent operation[edit]

*(p+0) = (n > 0) ? a0 : *(p+0)
*(p+1) = (n > 1) ? a1 : *(p+1)
...
*(p+M) = (n > M) ? aM : *(p+M)

Here M = N-1.

See also[edit]