Fix strict ansi violation in cephes. git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1344 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/math/cephes_emath.h b/mingw-w64-crt/math/cephes_emath.h index fa39af2..1d29590 100644 --- a/mingw-w64-crt/math/cephes_emath.h +++ b/mingw-w64-crt/math/cephes_emath.h
@@ -474,9 +474,15 @@ static __inline__ int __eiszero(const short unsigned int * a) { - if (*((long double*) a) == 0) - return (1); - return (0); + union { + long double ld; + unsigned short sh[8]; + } av; + av.ld = 0.0; + memcpy (av.sh, a, 12); + if (av.ld == 0.0) + return (1); + return (0); } /* Return nonzero if internal format number is zero. */
diff --git a/mingw-w64-crt/math/cephes_mconf.h b/mingw-w64-crt/math/cephes_mconf.h index d937524..79594d0 100644 --- a/mingw-w64-crt/math/cephes_mconf.h +++ b/mingw-w64-crt/math/cephes_mconf.h
@@ -25,13 +25,13 @@ #endif #if UNK -typedef union uLD { long double ld; } uLD; -typedef union uD { double d; } uD; +typedef union uLD { long double ld; unsigned short sh[8]; long lo[4]; } uLD; +typedef union uD { double d; unsigned short sh[4]; } uD; #elif IBMPC -typedef union uLD { const unsigned short sh[8]; const long double ld; } uLD; -typedef union uD { const unsigned short sh[4]; const double d; } uD; +typedef union uLD { unsigned short sh[8]; long double ld; long lo[4]; } uLD; +typedef union uD { unsigned short sh[4]; double d; } uD; #elif MIEEE -typedef union uLD { long lo[4]; long double ld; } uLD; +typedef union uLD { long lo[4]; long double ld; unsigned short sh[8]; } uLD; typedef union uD { unsigned short sh[4]; double d; } uD; #else #error Unknown uLD/uD type definition @@ -205,16 +205,15 @@ /* Polynomial evaluator: * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] */ -static __inline__ double p1evl(double x, const void *p, int n) +static __inline__ double p1evl(double x, const uD *p, int n) { register double y; - register double *P = (double *)p; n -= 1; - y = x + *P++; + y = x + p->d; p++; do { - y = y * x + *P++; + y = y * x + p->d; p++; } while (--n); return (y);
diff --git a/mingw-w64-crt/math/pow.c b/mingw-w64-crt/math/pow.c index 92874e1..78af29d 100644 --- a/mingw-w64-crt/math/pow.c +++ b/mingw-w64-crt/math/pow.c
@@ -281,7 +281,7 @@ extern double frexp ( double, int * ); extern double ldexp ( double, int ); extern double polevl ( double, void *, int ); -extern double p1evl ( double, void *, int ); +extern double p1evl ( double, uD *, int ); extern double __powi ( double, int ); extern int signbit ( double ); extern int isnan ( double );