MCPcopy Create free account
hub / github.com/LancePutnam/Gamma / floatToUInt

Function floatToUInt

src/Conversion.cpp:22–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22uint32_t floatToUInt(float value){
23 Twiddle<float> u(value);
24 u.u += 0x800000;
25
26 if(u.u & 0x40000000){ // mag outside [0, 1)
27 uint32_t shift = (u.u >> 23) & 0x7F;
28 return (1<<shift) | ((u.u & MaskFrac<float>()) >> (23 - shift));
29 }
30 else{
31 return 0;
32 }
33}
34
35int32_t floatToInt(float value){
36 Twiddle<float> u(value);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected