Batch of constants
-
template<typename T, class A, T... Values>
struct batch_constant batch of integral constants
Abstract representation of a batch of integral constants.
- Template Parameters:
batch_type – the type of the associated batch values.
Values – constants represented by this batch
Public Functions
-
inline batch_type as_batch() const noexcept
Generate a batch of
batch_type
from thisbatch_constant
.
-
inline operator batch_type() const noexcept
Generate a batch of
batch_type
from thisbatch_constant
.
-
inline constexpr T get(size_t i) const noexcept
Get the
i
th element of thisbatch_constant
.
-
template<typename T, class A, class G>
inline constexpr auto xsimd::make_batch_constant() noexcept -> decltype(detail::make_batch_constant<T, A, G>(detail::make_index_sequence<batch<T, A>::size>())) Build a
batch_constant
out of a generator function.The following generator produces a batch of
(n - 1, 0, 1, ... n-2)
struct Rot { static constexpr unsigned get(unsigned i, unsigned n) { return (i + n - 1) % n; } };
- Template Parameters:
batch_type – type of the (non-constant) batch to build
G – type used to generate that batch. That type must have a static member
get
that’s used to generate the batch constant. Conversely, the generated batch_constant has value{G::get(0, batch_size), ... , G::get(batch_size - 1, batch_size)}