Fix endianness test for Windows.
[portablexdr.git] / xdr_float.c
index bf6da27..5425af9 100644 (file)
@@ -91,8 +91,7 @@ xdr_float(xdrs, fp)
        register XDR *xdrs;
        register float *fp;
 {
-#if !defined(mc68000) && !defined(sparc) && !defined(__CYGWIN32__) && !defined(__MINGW32__) && !defined(linux)
-
+#if defined(vax)
        struct ieee_single is;
        struct vax_single vs, *vsp;
        struct sgl_limits *lim;
@@ -101,7 +100,7 @@ xdr_float(xdrs, fp)
        switch (xdrs->x_op) {
 
        case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(linux)
+#if !defined(vax)
                return (XDR_PUTLONG(xdrs, (long *)fp));
 #else
                vs = *((struct vax_single *)fp);
@@ -119,15 +118,15 @@ xdr_float(xdrs, fp)
                is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2;
        shipit:
                is.sign = vs.sign;
-               return (XDR_PUTLONG(xdrs, (long *)&is));
+               return (XDR_PUTLONG(xdrs, (long *)(void *)&is));
 #endif
 
        case XDR_DECODE:
-#if defined(mc68000) || defined(sparc) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(linux)
+#if !defined(vax)
                return (XDR_GETLONG(xdrs, (long *)fp));
 #else
                vsp = (struct vax_single *)fp;
-               if (!XDR_GETLONG(xdrs, (long *)&is))
+               if (!XDR_GETLONG(xdrs, (long *)(void *)&is))
                        return (FALSE);
                for (i = 0, lim = sgl_limits;
                        i < sizeof(sgl_limits)/sizeof(struct sgl_limits);
@@ -198,7 +197,7 @@ xdr_double(xdrs, dp)
        double *dp;
 {
        register long *lp;
-#if !defined(mc68000) && !defined(sparc) && !defined(__CYGWIN32__) && !defined(__MINGW32__) && !defined(linux)
+#if defined(vax)
        struct  ieee_double id;
        struct  vax_double vd;
        register struct dbl_limits *lim;
@@ -208,7 +207,7 @@ xdr_double(xdrs, dp)
        switch (xdrs->x_op) {
 
        case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(linux)
+#if !defined(vax)
                lp = (long *)dp;
 #else
                vd = *((struct vax_double *)dp);
@@ -231,7 +230,7 @@ xdr_double(xdrs, dp)
                                ((vd.mantissa4 >> 3) & MASK(13));
        shipit:
                id.sign = vd.sign;
-               lp = (long *)&id;
+               lp = (long *)(void *)&id;
 #endif
 #if defined(__CYGWIN32__) || defined(__MINGW32__)
                return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp));
@@ -240,7 +239,7 @@ xdr_double(xdrs, dp)
 #endif
 
        case XDR_DECODE:
-#if defined(mc68000) || defined(sparc) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(linux)
+#if !defined(vax)
                lp = (long *)dp;
 #if defined(__CYGWIN32__) || defined(__MINGW32__)
                return (XDR_GETLONG(xdrs, lp+1) && XDR_GETLONG(xdrs, lp));
@@ -248,7 +247,7 @@ xdr_double(xdrs, dp)
                return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
 #endif
 #else
-               lp = (long *)&id;
+               lp = (long *)(void *)&id;
                if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
                        return (FALSE);
                for (i = 0, lim = dbl_limits;
@@ -269,7 +268,7 @@ xdr_double(xdrs, dp)
                vd.mantissa4 = (id.mantissa2 << 3);
        doneit:
                vd.sign = id.sign;
-               *dp = *((double *)&vd);
+               *dp = *((double *)(void *)&vd);
                return (TRUE);
 #endif