E.V.E  0.1-beta

◆ bit_ceil

eve::bit_ceil = {}
inlineconstexpr

Callable object computing the bit_ceil operation.

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

Members Functions

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

template< unsigned_value T > auto operator()( T x ) const noexcept;

Parameters

x: unsigned value.

Return value

Computes elementwise the smallest integral power of two that is not smaller than x. If that value is not representable in T, the behavior is undefined.


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/bit_ceil.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'
<< "-> bit_ceil(pi) = " << eve::bit_ceil(pi) << '\n';
std::uint32_t xf = 48;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bit_ceil(xf) = " << eve::bit_ceil(xf) << '\n';
return 0;
}
constexpr callable_bit_ceil_ bit_ceil
Callable object computing the bit_ceil operation.
Definition: bit_ceil.hpp:73
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65