fix strict aliasing issue with mathlib.h IS_NAN() macro

I assume the memcpy will be nicely optimised away, but not really critical
anyway.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2012-11-02 18:40:42 +10:30
parent 352565504c
commit 726e4365c1

View File

@ -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];}