Browse Source

public: mathlib: convert FloatToHalf and HalfToFloat to use float_bits_t union

pull/2/head
Alibek Omarov 2 years ago
parent
commit
b96bfcfe7a
  1. 4
      public/xash3d_mathlib.c

4
public/xash3d_mathlib.c

@ -73,7 +73,7 @@ float SimpleSpline( float value )
word FloatToHalf( float v ) word FloatToHalf( float v )
{ {
unsigned int i = *((unsigned int *)&v); unsigned int i = FloatAsUint( v );
unsigned int e = (i >> 23) & 0x00ff; unsigned int e = (i >> 23) & 0x00ff;
unsigned int m = i & 0x007fffff; unsigned int m = i & 0x007fffff;
unsigned short h; unsigned short h;
@ -115,7 +115,7 @@ float HalfToFloat( word h )
} }
} }
return *((float *)&f); return UintAsFloat( f );
} }
/* /*

Loading…
Cancel
Save