E.V.E  0.1-beta

◆ bit_mask

eve::bit_mask = {}
inlineconstexpr

Callable object computing a bit mask.

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

Members Functions

Member Effect
operator() the computation of a bit mask
operator[] Construct a conditional version of current function object

auto operator()(value auto x) const noexcept;
Definition: value.hpp:31

Parameters

x: real value.

Return value

For each elementwise of x:

  • if the element is zero, an element with all bits unset is returned.
  • else an element of the type with all bits set is returned.

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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/bit_mask.hpp>
#include <eve/constant/inf.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_it pi = {14, 1, 3, 0, 16, 23000, 0, 27};
wide_ft pf = {14.0, 1.0, -0.0, 0.0, 16.0, 23000.0, eve::inf(eve::as<float>()), 27.0};
std::cout << "---- simd" << '\n'
<< "<- pi = " << pi << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bit_mask(pi) = " << eve::bit_mask(pi) << '\n'
<< "-> bit_mask(pf) = " << eve::bit_mask(pf) << '\n';
std::uint32_t xf = 48;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bit_mask(xf) = " << eve::bit_mask(xf) << '\n';
return 0;
}
constexpr callable_bit_mask_ bit_mask
Callable object computing a bit mask.
Definition: bit_mask.hpp:75
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65