MCPcopy Create free account
hub / github.com/Derious/cuMPC / BinaryToFloat

Function BinaryToFloat

dependence/eigen-3.4.0/test/bfloat16_float.cpp:26–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24using Eigen::bfloat16;
25
26float BinaryToFloat(uint32_t sign, uint32_t exponent, uint32_t high_mantissa,
27 uint32_t low_mantissa) {
28 float dest;
29 uint32_t src = (sign << 31) + (exponent << 23) + (high_mantissa << 16) + low_mantissa;
30 memcpy(static_cast<void*>(&dest),
31 static_cast<const void*>(&src), sizeof(dest));
32 return dest;
33}
34
35template<typename T>
36 void test_roundtrip() {

Callers 1

test_conversionFunction · 0.85

Calls 1

memcpyFunction · 0.85

Tested by

no test coverage detected