E.V.E  0.1-beta

◆ bit_andnot

eve::bit_andnot = {}
inlineconstexpr

Callable object computing the bitwise ANDNOT operation.

Required header: #include <eve/function/bit_andnot.hpp>

Members Functions

Member Effect
operator() the bitwise ANDNOT operation
operator[] Construct a conditional version of current function object

auto operator()(eve::value auto a0, eve::value auto ... xs) const noexcept;
Definition: value.hpp:31

Parameters

a0, xs: Instances of eve::value

Return value

The value returned is of same type as a0 and follows the bitwise operations semantic.

  • For two parameters it computes the bitwise ANDNOT of the two parameters
  • For more than two parameters the call is semantically equivalent to to bit_andnot(a0, bit_or(xs...))
Warning
the call bit_andnot(x, y) is semantically equivalent to x & ~y if x or y is an simd value, but the pure scalar calls imply the original C++ operators an may not exist due to C++ limitations.
Moreover if an hardware intrinsic exists, the infix syntax will not be able to use it.

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::bit_andnot

Parameters

cond : conditional expression

Return value

A Callable object so that the expression bit_andnot[cond](x, ...) is equivalent to if_else(cond,bit_andnot(x, ...),x)


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/bit_andnot.hpp>
#include <eve/literals.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
w_t pi = {3, 2, 3, 4}, qi = {4, 1, 1, ~0};
std::uint32_t z = 5;
std::cout << "---- simd" << '\n'
<< " <- pi = " << pi << '\n'
<< " <- qi = " << qi << '\n'
<< " <- z = " << z << '\n'
<< " -> bit_andnot(pi, qi) = " << eve::bit_andnot(pi, qi) << '\n'
<< " -> bit_andnot(z, qi) = " << eve::bit_andnot(z, qi) << '\n'
<< " -> bit_andnot(pi, z ) = " << eve::bit_andnot(pi, z) << '\n';
std::uint32_t mask = 1 >> 31;
float xi = -3.4565;
std::cout << "---- scalar" << '\n'
<< " <- xi = " << xi << '\n'
<< " <- mask = " << mask << '\n'
<< " -> bit_andnot(xi, mask) = " << eve::bit_andnot(xi, mask) << '\n';
return 0;
}
constexpr callable_bit_andnot_ bit_andnot
Callable object computing the bitwise ANDNOT operation.
Definition: bit_andnot.hpp:81
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65