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.
(cherry picked from commit 2e27b3ea87cdc870774a1cbe068494d9a1df233d)
This commit is contained in:
1 parent
7877f8ae0e
commit
aab1af5926
1 file changed
+14
-2
+14
-2
@@ -43,8 +43,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
|
||||
|
||||
Reference in new issue
Block a user