Commit in reactos/lib/msvcrt on MAIN
float/chgsign.c+9-41.5 -> 1.6
     /copysign.c+13-31.5 -> 1.6
     /fpclass.c+16-111.5 -> 1.6
     /isnan.c+34-141.6 -> 1.7
     /scalb.c+9-31.4 -> 1.5
math/frexp.c+9-31.5 -> 1.6
    /modf.c+59-331.4 -> 1.5
stdio/vfprintf.c+16-41.19 -> 1.20
     /vfwprint.c+16-41.18 -> 1.19
+181-79
9 modified files
- Fixed some 'dereferencing type-punned pointer will break strict-aliasing rules' 
  warnings on higher optimisation levels.

reactos/lib/msvcrt/float
chgsign.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- chgsign.c	11 Jul 2003 21:57:54 -0000	1.5
+++ chgsign.c	22 Aug 2004 20:32:32 -0000	1.6
@@ -7,12 +7,17 @@
  */
 double _chgsign( double __x )
 {
-	double_t *x = (double_t *)&x;
+	union
+	{
+	    double* __x;
+	    double_t *x;
+	} u;
+	u.__x = &__x;
 
-	if ( x->sign == 1 )
-		x->sign = 0;
+	if ( u.x->sign == 1 )
+		u.x->sign = 0;
 	else 
-		x->sign = 1;
+		u.x->sign = 1;
 
 	return __x;
 }

reactos/lib/msvcrt/float
copysign.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- copysign.c	11 Jul 2003 21:57:54 -0000	1.5
+++ copysign.c	22 Aug 2004 20:32:32 -0000	1.6
@@ -6,10 +6,20 @@
  */
 double _copysign (double __d, double __s)
 {
-  double_t *d = (double_t *)&__d;
-  double_t *s = (double_t *)&__s;
+  union
+  {
+      double*	__d;
+      double_t*	  d;
+  } d;
+  union 
+  {
+      double*	__s;
+      double_t*   s;
+  } s;
+  d.__d = &__d;
+  s.__s = &__s;
 
-  d->sign = s->sign;
+  d.d->sign = s.s->sign;
 
   return __d;
 }

reactos/lib/msvcrt/float
fpclass.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- fpclass.c	11 Jul 2003 21:57:54 -0000	1.5
+++ fpclass.c	22 Aug 2004 20:32:32 -0000	1.6
@@ -31,33 +31,38 @@
  * @implemented
  */
 fpclass_t _fpclass(double __d)
-{
-	double_t *d = (double_t *)&__d;
+{	
+	union
+	{
+		double*	  __d;
+		double_t*   d;
+	} d;
+	d.__d = &__d;
 
-	if ( d->exponent == 0 ) {
-		if ( d->mantissah == 0 &&  d->mantissal == 0 ) {
-			if ( d->sign ==0 )
+	if ( d.d->exponent == 0 ) {
+		if ( d.d->mantissah == 0 &&  d.d->mantissal == 0 ) {
+			if ( d.d->sign ==0 )
 				return FP_NZERO;
 			else
 				return FP_PZERO;
 		} else {
-			if ( d->sign ==0 )
+			if ( d.d->sign ==0 )
 				return FP_NDENORM;
 			else
 				return FP_PDENORM;
 		}
 	}
-	if (d->exponent == 0x7ff ) {
-		if ( d->mantissah == 0 &&  d->mantissal == 0 ) {
-			if ( d->sign ==0 )
+	if (d.d->exponent == 0x7ff ) {
+		if ( d.d->mantissah == 0 &&  d.d->mantissal == 0 ) {
+			if ( d.d->sign ==0 )
 				return FP_NINF;
 			else
 				return FP_PINF;
 		} 
-		else if ( d->mantissah == 0 &&  d->mantissal != 0 ) {
+		else if ( d.d->mantissah == 0 &&  d.d->mantissal != 0 ) {
 			return FP_QNAN;
 		}
-		else if ( d->mantissah == 0 &&  d->mantissal != 0 ) {
+		else if ( d.d->mantissah == 0 &&  d.d->mantissal != 0 ) {
 			return FP_SNAN;
 		}
 	

reactos/lib/msvcrt/float
isnan.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- isnan.c	11 Jul 2003 21:57:54 -0000	1.6
+++ isnan.c	22 Aug 2004 20:32:32 -0000	1.7
@@ -25,31 +25,46 @@
  * @implemented
  */
 int _isnan(double __x)
-{
-	double_t * x = (double_t *)&__x;
-	return ( x->exponent == 0x7ff  && ( x->mantissah != 0 || x->mantissal != 0 ));	
+{   
+	union
+	{
+		double*   __x;
+		double_t*   x;
+	} x;
+    	x.__x = &__x;
+	return ( x.x->exponent == 0x7ff  && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));	
 }
 
 int _isnanl(long double __x)
 {
 	/* Intel's extended format has the normally implicit 1 explicit
 	   present.  Sigh!  */
-	
-	long_double_t * x = (long_double_t *)&__x;
+	union
+	{
+		long double*   __x;
+		long_double_t*   x;
+	} x;
+	x.__x = &__x;
 	
 	
 	 /* IEEE 854 NaN's have the maximum possible
      exponent and a nonzero mantissa.  */
           
-	return (( x->exponent == 0x7fff)  
-	  && ( (x->mantissah & 0x80000000) != 0) 
-	  && ( (x->mantissah & (unsigned int)0x7fffffff) != 0  || x->mantissal != 0 ));	
+	return (( x.x->exponent == 0x7fff)  
+	  && ( (x.x->mantissah & 0x80000000) != 0) 
+	  && ( (x.x->mantissah & (unsigned int)0x7fffffff) != 0  || x.x->mantissal != 0 ));	
 }
 
 int _isinf(double __x)
 {
-	double_t * x = (double_t *)&__x;
-	return ( x->exponent == 0x7ff  && ( x->mantissah == 0 && x->mantissal == 0 ));	
+	union
+	{   
+		double*   __x;
+		double_t*   x;
+	} x;
+	
+	x.__x = &__x;
+	return ( x.x->exponent == 0x7ff  && ( x.x->mantissah == 0 && x.x->mantissal == 0 ));	
 }
 
 /*
@@ -64,15 +79,20 @@
 {
 	/* Intel's extended format has the normally implicit 1 explicit
 	   present.  Sigh!  */
-	   
-	long_double_t * x = (long_double_t *)&__x;
+	union
+	{
+		long double*   __x;
+                long_double_t*   x;
+	} x;
+	
+	x.__x = &__x;
 	
 	
 	 /* An IEEE 854 infinity has an exponent with the
      maximum possible value and a zero mantissa.  */
  
 		
-	if ( x->exponent == 0x7fff  && ( (x->mantissah == 0x80000000 )   && x->mantissal == 0 ))
-		return x->sign ? -1 : 1;
+	if ( x.x->exponent == 0x7fff  && ( (x.x->mantissah == 0x80000000 )   && x.x->mantissal == 0 ))
+		return x.x->sign ? -1 : 1;
 	return 0;
 }

reactos/lib/msvcrt/float
scalb.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- scalb.c	11 Jul 2003 21:57:54 -0000	1.4
+++ scalb.c	22 Aug 2004 20:32:32 -0000	1.5
@@ -5,10 +5,16 @@
  * @implemented
  */
 double _scalb( double __x, long e )
-{
-	double_t *x = (double_t *)&__x;
+{	
+	union
+	{
+		double*   __x;
+                double_t*   x;
+	} x;
 	
-	x->exponent += e;
+	x.__x = &__x;
+	
+	x.x->exponent += e;
 
 	return __x;
 }

reactos/lib/msvcrt/math
frexp.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- frexp.c	11 Jul 2003 21:57:54 -0000	1.5
+++ frexp.c	22 Aug 2004 20:32:32 -0000	1.6
@@ -8,13 +8,19 @@
 double
 frexp(double __x, int *exptr)
 {
-	double_t *x = (double_t *)&__x;
+	union
+	{
+		double*   __x;
+		double_t*   x;
+	} x;
+	
+	x.__x = &__x;
 	
 	if ( exptr != NULL )
-		*exptr = x->exponent - 0x3FE;
+		*exptr = x.x->exponent - 0x3FE;
 		
 	
-	x->exponent = 0x3FE;
+	x.x->exponent = 0x3FE;
 	
 	return __x; 
 }

reactos/lib/msvcrt/math
modf.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- modf.c	8 Sep 2002 10:22:51 -0000	1.4
+++ modf.c	22 Aug 2004 20:32:32 -0000	1.5
@@ -20,32 +20,45 @@
 
 double modf(double __x, double *__i)
 {
-	double_t * x = (double_t *)&__x;
-	double_t * iptr = ( double_t *)__i;
+	union
+	{
+		double*   __x;
+		double_t*   x;
+	} x;
+	union
+	{
+		double*     __i;
+		double_t*  iptr;
+	} iptr;
 
 	int j0;
 	unsigned int i;
-	j0 = x->exponent - 0x3ff;  /* exponent of x */	
+
+	x.__x = &__x;
+	iptr.__i = __i;
+
+
+	j0 = x.x->exponent - 0x3ff;  /* exponent of x */	
 	if(j0<20) {                     /* integer part in high x */
 		if(j0<0) {                  /* |x|<1 */
 			*__i = 0.0;
-			iptr->sign = x->sign;
+			iptr.iptr->sign = x.x->sign;
 			return __x;
 		} else {
 
-			if ( x->mantissah == 0 && x->mantissal == 0 ) {
+			if ( x.x->mantissah == 0 && x.x->mantissal == 0 ) {
 				*__i = __x;
 				return 0.0;
 			}
 
 			i = (0x000fffff)>>j0;
-			iptr->sign = x->sign;
-			iptr->exponent = x->exponent;
-			iptr->mantissah = x->mantissah&(~i);
-			iptr->mantissal = 0;
+			iptr.iptr->sign = x.x->sign;
+			iptr.iptr->exponent = x.x->exponent;
+			iptr.iptr->mantissah = x.x->mantissah&(~i);
+			iptr.iptr->mantissal = 0;
 			if ( __x == *__i ) {
 				__x = 0.0;
-				x->sign = iptr->sign;
+				x.x->sign = iptr.iptr->sign;
 				return __x;
 			}
 			return __x - *__i;
@@ -56,18 +69,18 @@
 			return __x;
 
 		__x = 0.0;
-		x->sign = iptr->sign;
+		x.x->sign = iptr.iptr->sign;
 		return __x;
 	} else {                        /* fraction part in low x */
 
 		i = ((unsigned)(0xffffffff))>>(j0-20);
-		iptr->sign = x->sign;
-		iptr->exponent = x->exponent;
-		iptr->mantissah = x->mantissah;
-		iptr->mantissal = x->mantissal&(~i);
+		iptr.iptr->sign = x.x->sign;
+		iptr.iptr->exponent = x.x->exponent;
+		iptr.iptr->mantissah = x.x->mantissah;
+		iptr.iptr->mantissal = x.x->mantissal&(~i);
 		if ( __x == *__i ) {
 			__x = 0.0;
-			x->sign = iptr->sign;
+			x.x->sign = iptr.iptr->sign;
 			return __x;
 		}
 		return __x - *__i;
@@ -77,31 +90,44 @@
 
 long double modfl(long double __x, long double *__i)
 {
-	long_double_t * x = (long_double_t *)&__x;
-	long_double_t * iptr = (long_double_t *)__i;
+	union
+	{
+		long double*   __x;
+		long_double_t*   x;
+	} x;
+	union
+	{
+		long double*    __i;
+		long_double_t* iptr;
+	} iptr;
 
 	int j0;
 	unsigned int i;
-	j0 = x->exponent - 0x3fff;  /* exponent of x */
+
+	x.__x = &__x;
+	iptr.__i = __i;
+
+
+	j0 = x.x->exponent - 0x3fff;  /* exponent of x */
 
 	if(j0<32) {                     /* integer part in high x */
 		if(j0<0) {                  /* |x|<1 */
 			*__i = 0.0L;
-			iptr->sign = x->sign;
+			iptr.iptr->sign = x.x->sign;
 			return __x;
 		} else {
 
 			i = ((unsigned int)(0xffffffff))>>(j0+1);
-			if ( x->mantissal == 0 && (x->mantissal & i) == 0 ) {
+			if ( x.x->mantissal == 0 && (x.x->mantissal & i) == 0 ) {
 				*__i =  __x;
 				__x = 0.0L;
-				x->sign = iptr->sign;
+				x.x->sign = iptr.iptr->sign;
 				return __x;
 			}
-			iptr->sign = x->sign;
-			iptr->exponent = x->exponent;
-			iptr->mantissah = x->mantissah&((~i));
-			iptr->mantissal = 0;
+			iptr.iptr->sign = x.x->sign;
+			iptr.iptr->exponent = x.x->exponent;
+			iptr.iptr->mantissah = x.x->mantissah&((~i));
+			iptr.iptr->mantissal = 0;
 		
 			return __x - *__i;
 		}
@@ -111,21 +137,21 @@
 			return __x;
 
 		__x = 0.0L;
-		x->sign = iptr->sign;
+		x.x->sign = iptr.iptr->sign;
 		return __x;
 	} else {                        /* fraction part in low x */
 
 		i = ((unsigned int)(0xffffffff))>>(j0-32);
-		if ( x->mantissal == 0 ) {
+		if ( x.x->mantissal == 0 ) {
 			*__i =  __x;
 			__x = 0.0L;
-			x->sign = iptr->sign;
+			x.x->sign = iptr.iptr->sign;
 			return __x;
 		}
-		iptr->sign = x->sign;
-		iptr->exponent = x->exponent;
-		iptr->mantissah = x->mantissah;
-		iptr->mantissal = x->mantissal&(~i);
+		iptr.iptr->sign = x.x->sign;
+		iptr.iptr->exponent = x.x->exponent;
+		iptr.iptr->mantissah = x.x->mantissah;
+		iptr.iptr->mantissal = x.x->mantissal&(~i);
 	
 		return __x - *__i;
 	}

reactos/lib/msvcrt/stdio
vfprintf.c 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- vfprintf.c	15 Jun 2004 08:53:53 -0000	1.19
+++ vfprintf.c	22 Aug 2004 20:32:32 -0000	1.20
@@ -219,10 +219,16 @@
 	char ro = 0;
 	int result, done = 0;
 
-	double_t *n = (double_t *)&__n;
+	union
+	{
+		double*  __n;
+		double_t*  n;
+	} n;
+	
+	n.__n = &__n;
 
 	if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
-		ie = ((unsigned int)n->exponent - (unsigned int)0x3ff);
+		ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff);
 		exponent = ie/3.321928;
 	}
 
@@ -422,10 +428,16 @@
 
 	int result, done = 0;
 
-	long_double_t *n = (long_double_t *)&__n;
+	union
+	{
+	    long double*   __n;
+	    long_double_t*   n;
+	} n;
+
+	n.__n = &__n;
 
 	if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
-		ie = ((unsigned int)n->exponent - (unsigned int)0x3fff);
+		ie = ((unsigned int)n.n->exponent - (unsigned int)0x3fff);
 		exponent = ie/3.321928;
 	}
 

reactos/lib/msvcrt/stdio
vfwprint.c 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- vfwprint.c	15 Jun 2004 08:53:53 -0000	1.18
+++ vfwprint.c	22 Aug 2004 20:32:32 -0000	1.19
@@ -226,10 +226,16 @@
 	char ro = 0;
 	int result, done = 0;
 
-	double_t *n = (double_t *)&__n;
+	union
+	{
+	    double*   __n;
+	    double_t*   n;
+	} n;
+
+	n.__n = &__n;
 
 	if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) {
-		ie = ((unsigned int)n->exponent - (unsigned int)0x3ff);
+		ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff);
 		exponent = ie/3.321928;
 	}
 
@@ -429,10 +435,16 @@
 
 	int result, done = 0;
 
-	long_double_t *n = (long_double_t *)&__n;
+	union
+	{
+		long double*   __n;
+		long_double_t*   n;
+	} n;
+
+	n.__n = &__n;
 
 	if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) {
-		ie = ((unsigned int)n->exponent - (unsigned int)0x3fff);
+		ie = ((unsigned int)n.n->exponent - (unsigned int)0x3fff);
 		exponent = ie/3.321928;
 	}
 
CVSspam 0.2.8