E.V.E
v2023.02.15

◆ bitofsign

eve::bitofsign = {}
inlineconstexpr

Computes the value in the input type of the bit of sign.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T bitofsign(T x) noexcept;
}
constexpr callable_bitofsign_ bitofsign
Computes the value in the input type of the bit of sign.
Definition: bitofsign.hpp:61
Definition: abi.hpp:18

Parameters

Return value

The value of the bit of sign is returned.

Note
  • bitofsign does NOT return a logical value
  • In particular, take care that for floating real values bitofsign does NOT return a logical value that can be tested, but mzero(as(x)) if x is negative and zero(as(x)) if x is positive, which both satisfy the eve::is_eqz predicate.
  • If you want to test if the bit of sign is set eve::is_negative is the right function to call.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {-1.0f, 0.0f, 3.0f, -0.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bitofsign(pf) = " << eve::bitofsign(pf) << '\n';
float xf = -32768.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bitofsign(xf) = " << eve::bitofsign(xf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65