Bitwise operators

bitwise_not()

per slot bitwise not

bitwise_or()

per slot bitwise or

bitwise_xor()

per slot bitwise xor

bitwise_and()

per slot bitwise and

bitwise_andnot()

per slot bitwise and not

bitwise_lshift()

per slot bitwise and

bitwise_rshift()

per slot bitwise and not

rotr()

per slot rotate right

rotl()

per slot rotate left


template<class T, class A>
inline auto bitwise_and(batch<T, A> const &x, batch<T, A> const &y) noexcept -> decltype(x & y)

Computes the bitwise and of the batches x and y.

Parameters:
  • x – batch involved in the operation.

  • y – batch involved in the operation.

Returns:

the result of the bitwise and.

template<class T, class A>
inline auto bitwise_and(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept -> decltype(x & y)

Computes the bitwise and of the batches x and y.

Parameters:
  • x – batch involved in the operation.

  • y – batch involved in the operation.

Returns:

the result of the bitwise and.

template<class T, class A>
inline batch<T, A> bitwise_andnot(batch<T, A> const &x, batch<T, A> const &y) noexcept

Computes the bitwise and not of batches x and y.

Parameters:
  • x – batch involved in the operation.

  • y – batch involved in the operation.

Returns:

the result of the bitwise and not.

template<class T, class A>
inline batch<T, A> bitwise_lshift(batch<T, A> const &x, int shift) noexcept

Perform a bitwise shift to the left.

Parameters:
  • x – batch of T_in

  • shift – scalar amount to shift

Returns:

shifted x.

template<class T, class A>
inline batch<T, A> bitwise_not(batch<T, A> const &x) noexcept

Computes the bitwise not of batch x.

Parameters:

x – batch involved in the operation.

Returns:

the result of the bitwise not.

template<class T, class A>
inline batch_bool<T, A> bitwise_not(batch_bool<T, A> const &x) noexcept

Computes the bitwise not of batch x.

Parameters:

x – batch involved in the operation.

Returns:

the result of the bitwise not.

template<class T, class A>
inline auto bitwise_or(batch<T, A> const &x, batch<T, A> const &y) noexcept -> decltype(x | y)

Computes the bitwise or of the batches x and y.

Parameters:
  • x – scalar or batch of scalars

  • y – scalar or batch of scalars

Returns:

the result of the bitwise or.

template<class T, class A>
inline auto bitwise_or(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept -> decltype(x | y)

Computes the bitwise or of the batches x and y.

Parameters:
  • x – scalar or batch of scalars

  • y – scalar or batch of scalars

Returns:

the result of the bitwise or.

template<class T, class A>
inline batch<T, A> bitwise_rshift(batch<T, A> const &x, int shift) noexcept

Perform a bitwise shift to the right.

Parameters:
  • x – batch of T_in

  • shift – scalar amount to shift

Returns:

shifted x.

template<class T, class A>
inline auto bitwise_xor(batch<T, A> const &x, batch<T, A> const &y) noexcept -> decltype(x ^ y)

Computes the bitwise xor of the batches x and y.

Parameters:
  • x – scalar or batch of scalars

  • y – scalar or batch of scalars

Returns:

the result of the bitwise xor.

template<class T, class A>
inline auto bitwise_xor(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept -> decltype(x ^ y)

Computes the bitwise xor of the batches x and y.

Parameters:
  • x – scalar or batch of scalars

  • y – scalar or batch of scalars

Returns:

the result of the bitwise xor.

template<class T, class A>
inline batch<T, A> rotl(batch<T, A> const &x, int shift) noexcept

Perform a bitwise shift to the left, reintroducing the shifted out bits to the right.

Parameters:
  • x – batch to rotate

  • shift – scalar amount to shift

Returns:

rotated x.

template<class T, class A>
inline batch<T, A> rotr(batch<T, A> const &x, int shift) noexcept

Perform a bitwise shift to the right, reintroducing the shifted out bits to the left.

Parameters:
  • x – batch to rotate

  • shift – scalar amount to shift

Returns:

rotated x.