remove IS_NAN (isnan exists)

master
an 2019-12-03 01:51:23 -05:00
parent 7b2975f5ba
commit da538dc69f
3 changed files with 6 additions and 22 deletions

View File

@ -35,22 +35,6 @@ struct mplane_s;
extern vec3_t vec3_origin;
#define nanmask (255 << 23) /* 7F800000 */
#if 0 /* macro is violating strict aliasing rules */
#define IS_NAN(x) (((*(int32_t *) (char *) &x) & nanmask) == nanmask)
#else
static inline int32_t IS_NAN(float x)
{
union
{
float f;
int32_t i;
} num;
num.f = x;
return ((num.i & nanmask) == nanmask);
}
#endif
#define Q_rint(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5))
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])

View File

@ -690,17 +690,17 @@ static void PF_traceline(void)
/* FIXME FIXME FIXME: Why do we hit this with certain progs.dat ?? */
if(developer.value)
{
if(IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) ||
IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2]))
if(isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]) ||
isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
{
Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent));
}
}
if(IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]))
if(isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]))
v1[0] = v1[1] = v1[2] = 0;
if(IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2]))
if(isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
v2[0] = v2[1] = v2[2] = 0;
trace = SV_Move(v1, vec3_origin, vec3_origin, v2, nomonsters, ent);

View File

@ -93,12 +93,12 @@ void SV_CheckVelocity(edict_t *ent)
//
for(i = 0 ; i < 3 ; i++)
{
if(IS_NAN(ent->v.velocity[i]))
if(isnan(ent->v.velocity[i]))
{
Con_Printf("Got a NaN velocity on %s\n", PR_GetString(ent->v.classname));
ent->v.velocity[i] = 0;
}
if(IS_NAN(ent->v.origin[i]))
if(isnan(ent->v.origin[i]))
{
Con_Printf("Got a NaN origin on %s\n", PR_GetString(ent->v.classname));
ent->v.origin[i] = 0;