Computes a a bitwise reinterpretation of an object.
Defined in Header
#include <eve/module/core.hpp>
{
{ template<value From, scalar_value To>
}
constexpr callable_bit_cast_ bit_cast
Computes a a bitwise reinterpretation of an object.
Definition: bit_cast.hpp:64
Lightweight type-wrapper.
Definition: as.hpp:29
Parameters
Template parameters
- To: scalar type to which each element of
x
is casted
Return value
The bits of x of type From reinterpreted as being those of a variable of type To is returned.
Every bit in the value representation of the returned To object is equal to the corresponding bit in the object representation of from. The values of padding bits in the returned To object are unspecified.
If there is no value of type To corresponding to the value representation produced, the behavior is undefined. If there are multiple such values, which value is produced is unspecified.
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using iT = std::int32_t;
int main()
{
wide_ft pf = {1.0f, 2.0f, -1.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> eve::bit_cast(pf,as<wide_it>()) = " << std::hex << eve::bit_cast(pf, eve::as<wide_it>()) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::bit_cast(xf, as<iT>()) = " << std::hex << eve::bit_cast(xf, eve::as<iT>()) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65