diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index a0e7b8103..5f8c900d2 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -50,13 +50,9 @@ # define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -extern int nanmask; - #define EQUAL_EPSILON 0.001 #define RINT(x) (floor ((x) + 0.5)) -#define IS_NAN(x) (((*(int *) (char *) &x) & nanmask) == nanmask) - #define Blend(a,b,blend) ((1 - (blend)) * (a) + (blend) * (b)) #include "QF/math/vector.h" diff --git a/libs/util/mathlib.c b/libs/util/mathlib.c index 9f8aa2def..3846f9dd7 100644 --- a/libs/util/mathlib.c +++ b/libs/util/mathlib.c @@ -47,7 +47,6 @@ #include "QF/set.h" #include "QF/sys.h" -VISIBLE int nanmask = 255 << 23; static vec3_t _vec3_origin = { 0, 0, 0 }; VISIBLE const vec_t * const vec3_origin = _vec3_origin; static quat_t _quat_origin = { 0, 0, 0, 0 }; diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index ab2b4f966..552fe227a 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -88,18 +88,17 @@ void SV_CheckVelocity (edict_t *ent) { float wishspeed; -// int i; // bound velocity #if 0 - for (i = 0; i < 3; i++) { - if (IS_NAN (SVvector (ent, velocity)[i])) { + for (int i = 0; i < 3; i++) { + if (isnan (SVvector (ent, velocity)[i])) { Sys_Printf ("Got a NaN velocity on %s\n", PR_GetString (&sv_pr_state, SVstring (ent, classname))); SVvector (ent, velocity)[i] = 0; } - if (IS_NAN (SVvector (ent, origin)[i])) { + if (isnan (SVvector (ent, origin)[i])) { Sys_Printf ("Got a NaN origin on %s\n", PR_GetString (&sv_pr_state, SVstring (ent, classname))); diff --git a/qw/source/sv_phys.c b/qw/source/sv_phys.c index 856a5ef16..5e1122053 100644 --- a/qw/source/sv_phys.c +++ b/qw/source/sv_phys.c @@ -87,18 +87,17 @@ void SV_CheckVelocity (edict_t *ent) { float wishspeed; -// int i; // bound velocity #if 0 - for (i = 0; i < 3; i++) { - if (IS_NAN (SVvector (ent, velocity)[i])) { + for (int i = 0; i < 3; i++) { + if (isnan (SVvector (ent, velocity)[i])) { Sys_Printf ("Got a NaN velocity on %s\n", PR_GetString (&sv_pr_state, SVstring (ent, classname))); SVvector (ent, velocity)[i] = 0; } - if (IS_NAN (SVvector (ent, origin)[i])) { + if (isnan (SVvector (ent, origin)[i])) { Sys_Printf ("Got a NaN origin on %s\n", PR_GetString (&sv_pr_state, SVstring (ent, classname)));