| 31 | using HalfBits = uint16_t; |
| 32 | |
| 33 | class alignas(2) half { |
| 34 | public: |
| 35 | HalfBits bits; |
| 36 | |
| 37 | half() = default; |
| 38 | |
| 39 | half(const half& f) : bits(f.bits) {} |
| 40 | |
| 41 | explicit half(float other) { bits = fp16_ieee_from_fp32_value(other); } |
| 42 | |
| 43 | void operator=(float f) { *this = half(f); } |
| 44 | |
| 45 | operator float() const { return fp16_ieee_to_fp32_value(bits); } |
| 46 | }; |
| 47 | |
| 48 | template <typename T> |
| 49 | struct alignas(sizeof(T)) Vec4 { |