MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / frexp

Function frexp

Source/astcenc_vecmathlib.h:566–577  ·  view source on GitHub ↗

* @brief Extract mantissa and exponent of a float value. * * @param a The input value. * @param[out] exp The output exponent. * * @return The mantissa. */

Source from the content-addressed store, hash-verified

564 * @return The mantissa.
565 */
566static 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.

Callers 1

float_to_lnsFunction · 0.70

Calls 2

float_as_intFunction · 0.70
int_as_floatFunction · 0.70

Tested by

no test coverage detected