mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fixed2float-funcs' into 'master'
Turn FIXED_TO_FLOAT into a function See merge request STJr/SRB2!869
This commit is contained in:
commit
a2a4a4a321
1 changed files with 14 additions and 2 deletions
|
|
@ -38,8 +38,20 @@ typedef INT32 fixed_t;
|
||||||
/*!
|
/*!
|
||||||
\brief convert fixed_t into floating number
|
\brief convert fixed_t into floating number
|
||||||
*/
|
*/
|
||||||
#define FIXED_TO_FLOAT(x) (((float)(x)) / ((float)FRACUNIT))
|
|
||||||
#define FLOAT_TO_FIXED(f) (fixed_t)((f) * ((float)FRACUNIT))
|
FUNCMATH FUNCINLINE static ATTRINLINE float FixedToFloat(fixed_t x)
|
||||||
|
{
|
||||||
|
return x / (float)FRACUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
|
||||||
|
{
|
||||||
|
return (fixed_t)(f * FRACUNIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for backwards compat
|
||||||
|
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
|
||||||
|
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
||||||
|
|
||||||
|
|
||||||
#if defined (__WATCOMC__) && FRACBITS == 16
|
#if defined (__WATCOMC__) && FRACBITS == 16
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue