batch_constant

struct

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

operator batch_type() const

Generate a batch of batch_type from this batch_constant.

constexpr value_type get(size_t i) const

Get the i th element of this batch_constant.

template<class batch_type, class G>
constexpr auto xsimd::make_batch_constant()

Build a batch_constant out of a generator function.

The following generator produces a batch of

(n - 1, 0, 1, ... n-2)
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)}

struct Rot
{
    static constexpr unsigned get(unsigned i, unsigned n)
    {
        return (i + n - 1) % n;
    }
};