From 304d4258d3a49488f570b8ad71931faa7e5d40ba Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 3 Oct 2009 12:31:59 +0000 Subject: * Merge ioq3-r1498, by popular demand --- src/qcommon/q_math.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/qcommon/q_math.c') diff --git a/src/qcommon/q_math.c b/src/qcommon/q_math.c index a3a7b191..e7924073 100644 --- a/src/qcommon/q_math.c +++ b/src/qcommon/q_math.c @@ -550,10 +550,7 @@ void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out ) */ float Q_rsqrt( float number ) { - union { - float f; - int i; - } t; + floatint_t t; float x2, y; const float threehalfs = 1.5F; @@ -568,9 +565,10 @@ float Q_rsqrt( float number ) } float Q_fabs( float f ) { - int tmp = * ( int * ) &f; - tmp &= 0x7FFFFFFF; - return * ( float * ) &tmp; + floatint_t fi; + fi.f = f; + fi.i &= 0x7FFFFFFF; + return fi.f; } #endif @@ -1587,15 +1585,11 @@ Don't pass doubles to this */ int Q_isnan( float x ) { - union - { - float f; - unsigned int i; - } t; + floatint_t fi; - t.f = x; - t.i &= 0x7FFFFFFF; - t.i = 0x7F800000 - t.i; + fi.f = x; + fi.ui &= 0x7FFFFFFF; + fi.ui = 0x7F800000 - fi.ui; - return (int)( (unsigned int)t.i >> 31 ); + return (int)( (unsigned int)fi.ui >> 31 ); } -- cgit