E.V.E
v2022.03.00

◆ bit_or

eve::bit_or = {}
inlineconstexpr

Computes the bitwise OR of its arguments.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::value Ts... >
T bit_or(T x, Ts... xs) noexcept;
}
Definition: value.hpp:31
constexpr callable_bit_or_ bit_or
Computes the bitwise OR of its arguments.
Definition: bit_or.hpp:69
Definition: all_of.hpp:22

Parameters

Return value

The value of the bitwise OR of its arguments in the type of the first one is returned.

Note
Although the infix notation with | is supported for two parameters, the | operator on standard scalar types is the original one and so can lead to automatic promotion. Moreover, and due to C++ limitations is not available for floating point scalar entries.

Example

#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_or(pi, qi) = " << eve::bit_or(pi, qi) << '\n'
<< " -> bit_or(z, qi) = " << eve::bit_or(z, qi) << '\n'
<< " -> bit_or(pi, z ) = " << eve::bit_or(pi, z) << '\n';
std::uint32_t mask = 1 >> 31;
float xi = -3.4565;
std::cout << "---- scalar" << '\n'
<< " <- xi = " << xi << '\n'
<< " <- mask = " << mask << '\n'
<< " -> bit_or(xi, mask) = " << eve::bit_or(xi, mask) << '\n';
return 0;
}
constexpr callable_pi_ pi
Callable object computing the constant .
Definition: pi.hpp:49
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::bit_or[mask](x, ...) provides a masked version of bit_or which is equivalent to if_else(mask, bit_or(x, ...), x)

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    w_t pi = {3, 2, 3, 4}, qi = {4, 1, 1, ~0};
    std::cout << "---- simd" << '\n'
    << " <- pi = " << pi << '\n'
    << " <- qi = " << qi << '\n'
    << " -> bit_or[pi < qi](pi, qi) = " << eve::bit_or[pi < qi](pi, qi) << '\n';
    return 0;
    }