From a2a2504886663dfe810d7f0c263ded238c7c911a Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Wed, 15 Mar 2023 19:39:18 -0400 Subject: [PATCH] Inline anglemod --- source/mathlib.c | 13 ------------- source/mathlib.h | 7 ++++++- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/source/mathlib.c b/source/mathlib.c index d539608..327ba83 100644 --- a/source/mathlib.c +++ b/source/mathlib.c @@ -210,19 +210,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, /*-----------------------------------------------------------------*/ - -float anglemod(float a) -{ -#if 0 - if (a >= 0) - a -= 360*(int)(a/360); - else - a += 360*( 1 + (int)(-a/360) ); -#endif - a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535); - return a; -} - /* ================== BOPS_Error diff --git a/source/mathlib.h b/source/mathlib.h index a657e3a..18017be 100644 --- a/source/mathlib.h +++ b/source/mathlib.h @@ -120,7 +120,12 @@ int GreatestCommonDivisor (int i1, int i2); void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); -float anglemod(float a); + +static inline float anglemod(float a) +{ + a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535); + return a; +} #define VectorL2Compare(v, w, m) \ (_mathlib_temp_float1 = (m) * (m), \