E.V.E  0.1-beta

◆ lohi

eve::lohi = {}
inlineconstexpr

Callable object computing the lohi pair of values.

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

Members Functions

Member Effect
operator() the computation of the lohi pair of values
operator[] Construct a conditional version of current function object

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

Parameters

x: integral_value.

Return value

Computes the elementwise the lower and higher parts of the input values, as a pair of unsigned integers


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/lohi.hpp>
#include <eve/wide.hpp>
#include <eve/constant/mindenormal.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_uit i32 = {0, 1, 2, 3}; //, 65536+1, 65536+8, 65536+16, 65536+32};
wide_ui8t i8 = {0, 1, 2, 3, 16+0, 16+2, 16+4, 16+8};
auto [m, e] = eve::lohi(i32);
auto [m8, e8] = eve::lohi(i8);
std::cout << "---- simd (hexadecimal output)" << '\n'
<< std::hex
<< "<- i32 = " << i32 << '\n'
<< "-> lohi(i32) = [" << '\n'
<< " " << m << ", \n"
<< " " << e << '\n'
<< " ]\n"
<< std::hex << "<- i8 = " << i8 << '\n'
<< "-> lohi(i8 ) = [" << '\n'
<< " " << m8 << ", \n"
<< " " << e8 << '\n'
<< " ]\n";
std::int32_t x = 100000;
std::int8_t y = 100;
auto [sm0, se0] = eve::lohi(x);
auto [sm1, se1] = eve::lohi(y);
std::cout << "---- scalar (hexadecimal output)" << '\n'
<< std::hex << "<- x = " << x << '\n'
<< "-> lohi(x) = [" << sm0 << ", " << se0 << "]\n"
<< "<- y = " << y << '\n'
<< "-> lohi(y) = [" << int(sm1) << ", " << int(se1) << "]\n"
;
return 0;
}
constexpr callable_lohi_ lohi
Callable object computing the lohi pair of values.
Definition: lohi.hpp:72
Wrapper for SIMD registers.
Definition: wide.hpp:65