diff --git a/include/mathlib.h b/include/mathlib.h index c92e0d9..89ca7cc 100644 --- a/include/mathlib.h +++ b/include/mathlib.h @@ -57,7 +57,11 @@ struct mplane_s; extern vec3_t vec3_origin; extern int nanmask; -#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) +#define IS_NAN(x) ({ \ + int tmp; \ + memcpy(&tmp, &x, sizeof(int)); \ + ((tmp & nanmask) == nanmask); \ +}) #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) #define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}