MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / frexp

Function frexp

external/astc-encoder/Source/astcenc_vecmathlib.h:542–553  ·  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

540 * @return The mantissa.
541 */
542static ASTCENC_SIMD_INLINE vfloat4 frexp(vfloat4 a, vint4& exp)
543{
544 // Interpret the bits as an integer
545 vint4 ai = float_as_int(a);
546
547 // Extract and unbias the exponent
548 exp = (lsr<23>(ai) & 0xFF) - 126;
549
550 // Extract and unbias the mantissa
551 vint4 manti = (ai & static_cast<int>(0x807FFFFF)) | 0x3F000000;
552 return int_as_float(manti);
553}
554
555/**
556 * @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