mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Turn the fixed-float convert macros into inline functions, like those in GZDoom. The old macros get to be just the same as calling these inline functions.
This commit is contained in:
parent
48e8c9058a
commit
2e27b3ea87
1 changed files with 14 additions and 2 deletions
|
@ -38,8 +38,20 @@ typedef INT32 fixed_t;
|
|||
/*!
|
||||
\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 inline float FixedToFloat(fixed_t x)
|
||||
{
|
||||
return x / (float)FRACUNIT;
|
||||
}
|
||||
|
||||
FUNCMATH FUNCINLINE static inline 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
|
||||
|
|
Loading…
Reference in a new issue