E.V.E
v2022.09.01

◆ signmask

eve::signmask = {}
inlineconstexpr

Computes a value in which the most significant bit is the only bit set.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T signmask(as<T> x) noexcept;
}
constexpr callable_signmask_ signmask
Computes a value in which the most significant bit is the only bit set.
Definition: signmask.hpp:58
Definition: all_of.hpp:22
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::signmask(as<T>()) returns a value of type T for which each element has all its bits unset except the highest.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> signmask(as<wide_ft>()) = " << eve::signmask(eve::as<wide_ft>()) << std::endl
<< "-> signmask(as<wide_it>()) = " << eve::signmask(eve::as<wide_it>()) << std::endl
<< "-> signmask(as(wxf)) = " << eve::signmask(eve::as(wxf)) << std::endl
<< "-> signmask(as(wxi)) = " << eve::signmask(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> signmask(as<float>()) = " << eve::signmask(eve::as(float())) << std::endl
<< "-> signmask(as<std::int16_t>()) = " << eve::signmask(eve::as(std::int16_t())) << std::endl
<< "-> signmask(as<xf)) = " << eve::signmask(eve::as(xf)) << std::endl
<< "-> signmask(as<xi)) = " << eve::signmask(eve::as(xi)) << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65