* @brief Extract mantissa and exponent of a float value. * * @param a The input value. * @param[out] exp The output exponent. * * @return The mantissa. */
| 564 | * @return The mantissa. |
| 565 | */ |
| 566 | static ASTCENC_SIMD_INLINE vfloat4 frexp(vfloat4 a, vint4& exp) |
| 567 | { |
| 568 | // Interpret the bits as an integer |
| 569 | vint4 ai = float_as_int(a); |
| 570 | |
| 571 | // Extract and unbias the exponent |
| 572 | exp = (lsr<23>(ai) & 0xFF) - 126; |
| 573 | |
| 574 | // Extract and unbias the mantissa |
| 575 | vint4 manti = (ai & static_cast<int>(0x807FFFFF)) | 0x3F000000; |
| 576 | return int_as_float(manti); |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * @brief Convert float to 16-bit LNS. |
no test coverage detected