E.V.E  0.1-beta

◆ firstbitunset

eve::firstbitunset = {}
inlineconstexpr

Callable object computing the firstbitunset operation.

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

Members Functions

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

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

Parameters

x: unsigned value.

Return value

Computes elementwise the bit pattern in which the only bit set (if it exists) is the first bit unset (beginning with the least significant bit) in the input.


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/firstbitunset.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_it pi = {14, 1, 3, 7, 20, 23000, 0, 27};
std::cout << "---- simd" << '\n'
<< "<- pi = " << pi << '\n'
<< "-> firstbitunset(pi) = " << eve::firstbitunset(pi) << '\n';
std::uint32_t xf = 48;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> firstbitunset(xf) = " << eve::firstbitunset(xf) << '\n';
return 0;
}
constexpr callable_firstbitunset_ firstbitunset
Callable object computing the firstbitunset operation.
Definition: firstbitunset.hpp:73
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65