E.V.E  0.1-beta

◆ bit_ornot

eve::bit_ornot = {}
inlineconstexpr

Callable object computing the bitwise ORNOT operation.

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

Members Functions

Member Effect
operator() the bitwise ORNOT 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 ORNOT of the two parameters
  • For more than two parameters the call is semantically equivalent to to bit_ornot(a0, bit_or(xs...))
Warning
the call bit_ornot(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_ornot

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/bit_ornot.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_ornot(pi, qi) = " << eve::bit_ornot(pi, qi) << '\n'
<< " -> bit_ornot(z, qi) = " << eve::bit_ornot(z, qi) << '\n'
<< " -> bit_ornot(pi, z ) = " << eve::bit_ornot(pi, z) << '\n';
std::uint32_t mask = 1 >> 31;
float xi = -3.4565;
std::cout << "---- scalar" << '\n'
<< " <- xi = " << xi << '\n'
<< " <- mask = " << mask << '\n'
<< " -> bit_ornot(xi, mask) = " << eve::bit_ornot(xi, mask) << '\n';
return 0;
}
constexpr callable_bit_ornot_ bit_ornot
Callable object computing the bitwise ORNOT operation.
Definition: bit_ornot.hpp:81
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65