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