mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-06 08:55:05 +01:00
public: mathlib: convert FloatToHalf and HalfToFloat to use float_bits_t union
This commit is contained in:
parent
412c635499
commit
b96bfcfe7a
@ -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…
Reference in New Issue
Block a user