From 6ff76802eba23e482902c86fe7b17e06b7a53aee Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 12 Apr 2025 15:43:17 +0200 Subject: [PATCH] convert fixed to float with multiplication instead of division --- src/m_fixed.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 3f1acd7ae..8f537b328 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -39,9 +39,11 @@ typedef UINT32 ufixed_t; \brief convert fixed_t into floating number */ +static const float FLOATUNIT = (1.0f / (float)FRACUNIT); + FUNCMATH FUNCINLINE static ATTRINLINE float FixedToFloat(fixed_t x) { - return x / (float)FRACUNIT; + return x * FLOATUNIT; } FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)