E.V.E  0.1-beta

◆ hi

eve::hi = {}
inlineconstexpr

Callable object computing the higher part of the values.

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

Members Functions

Member Effect
operator() the computation of the higher part of the 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 higher half of the value, returning each element as an unsigned integer of half the size of the input element.

If you also need the lower part lohi is more efficient.


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/hi.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};
std::cout << "---- simd (hexadecimal output)" << '\n'
<< std::hex
<< "<- i32 = " << i32 << '\n'
<< "-> hi(i32) = " << eve::hi(i32) << '\n'
<< std::hex << "<- i8 = " << i8 << '\n'
<< "-> hi(i8 ) = " << eve::hi(i8) << '\n';
std::int32_t x = 100000;
std::int8_t y = 100;
std::cout << "---- scalar (hexadecimal output)" << '\n'
<< std::hex << "<- x = " << x << '\n'
<< "-> hi(x) = " << eve::hi(x) << '\n'
<< "<- y = " << y << '\n'
<< "-> hi(y) = " << int(eve::hi(y)) << '\n'
;
return 0;
}
constexpr callable_hi_ hi
Callable object computing the higher part of the values.
Definition: hi.hpp:59
Wrapper for SIMD registers.
Definition: wide.hpp:65