| 38 | #endif |
| 39 | |
| 40 | inline float float8e5m2_to_float(f8e5m2_t x) { |
| 41 | f16_t val = 0; |
| 42 | #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 43 | memcpy(&val, &x, sizeof(f8e5m2_t)); |
| 44 | #else |
| 45 | memcpy((char*)&val + sizeof(f8e5m2_t), &x, sizeof(f8e5m2_t)); |
| 46 | #endif |
| 47 | return half_to_float(val); |
| 48 | } |
| 49 | [[maybe_unused]] inline f8e5m2_t float_to_float8e5m2(float x) { |
| 50 | f16_t val = float_to_half(x); |
| 51 | f8e5m2_t out; |