MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / unpack

Function unpack

transcoder/basisu_transcoder_internal.h:2149–2159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2147 }
2148
2149 inline void unpack(float p, int& e_unbiased, uint32_t& mant)
2150 {
2151 // kill any denorms
2152 if (p < FLT_MIN)
2153 p = 0;
2154
2155 union { float f; uint32_t u; } x;
2156 x.f = p;
2157 e_unbiased = int((x.u >> 23) & 0xFF) - 127;
2158 mant = (x.u & 0x7FFFFFu); // 23-bit mantissa
2159 }
2160
2161 // Returns estimated bits given probability p, approximates -log2f(p).
2162 inline float bits_from_prob_linear(float p)

Callers 1

bits_from_prob_linearFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected