batch_bool

template <class T, std::size_t N>
class xsimd::batch_bool

Batch of boolean values.

The batch_bool class represents a batch of boolean values, that can be used in operations involving batches of integer or floating point values. The boolean values are stored as integer or floating point values, depending on the type of batch they are dedicated to.

Template Parameters
  • T: The value type used for encoding boolean.
  • N: The number of scalar in the batch.

Inherits from xsimd::simd_batch_bool< batch_bool< T, N > >

Public Functions

batch_bool()

Builds an uninitialized batch of boolean values.

batch_bool(bool b)

Initializes all the values of the batch to b.

xsimd::batch_bool::batch_bool(bool b0, ..., bool bn)

Initializes a batch of booleans with the specified boolean values.

batch_bool(const simd_data &rhs)

Initializes a batch of boolean with the specified SIMD value.

batch_bool &operator=(const simd_data &rhs)

Assigns the specified SIMD value.

operator simd_data() const

Converts this to a SIMD value.

Logical operators

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator&(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Computes the bitwise and of the batches lhs and rhs.

Return
the result of the bitwise and.
Parameters
  • lhs: batch involved in the operation.
  • rhs: batch involved in the operation.

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator|(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Computes the bitwise or of the batches lhs and rhs.

Return
the result of the bitwise or.
Parameters
  • lhs: batch involved in the operation.
  • rhs: batch involved in the operation.

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator^(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Computes the bitwise xor of the batches lhs and rhs.

Return
the result of the bitwise xor.
Parameters
  • lhs: batch involved in the operation.
  • rhs: batch involved in the operation.

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator~(const batch_bool<T, N> &rhs)

Computes the bitwise not of the batch rhs.

Return
the result of the bitwise not.
Parameters
  • rhs: batch involved in the operation.

template <class T, std::size_t N>
batch_bool<T, N> xsimd::bitwise_andnot(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Computes the bitwise and not of the batches lhs and rhs.

Equivalent to

lhs & ~rhs
.
Return
the result of the bitwise not.
Parameters
  • lhs: batch involved in the operation.
  • rhs: batch involved in the operation.

Comparison operators

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator==(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Element-wise equality of batches lhs and rhs.

Return
the result of the equality comparison.
Parameters
  • lhs: batch involved in the comparison.
  • rhs: batch involved in the comparison.

template <class T, std::size_t N>
batch_bool<T, N> xsimd::operator!=(const batch_bool<T, N> &lhs, const batch_bool<T, N> &rhs)

Element-wise inequality of batches lhs and rhs.

Return
the result of the inequality comparison.
Parameters
  • lhs: batch involved in the comparison.
  • rhs: batch involved in the comparison.

Reducers

template <class T, std::size_t N>
bool xsimd::all(const batch_bool<T, N> &rhs)

Returns true if all the boolean values in the batch are true, false otherwise.

Return
a boolean scalar.
Parameters
  • rhs: the batch to reduce.

template <class T, std::size_t N>
bool xsimd::any(const batch_bool<T, N> &rhs)

Return true if any of the boolean values in the batch is true, false otherwise.

Return
a boolean scalar.
Parameters
  • rhs: the batch to reduce.