This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] SPU single precision floating point macros and functions
- From: Andrew_Pinski at PlayStation dot Sony dot Com
- To: Patrick Mansfield <patmans at us dot ibm dot com>
- Cc: Jeff Johnston <jjohnstn at redhat dot com>, newlib at sourceware dot org
- Date: Wed, 25 Apr 2007 16:37:22 -0700
- Subject: Re: [PATCH] SPU single precision floating point macros and functions
newlib-owner@sourceware.org wrote on 04/25/2007 04:27:03 PM:
> Index: my-base-quilt/newlib/libc/include/ieeefp.h
> ===================================================================
> --- my-base-quilt.orig/newlib/libc/include/ieeefp.h
> +++ my-base-quilt/newlib/libc/include/ieeefp.h
> @@ -213,14 +213,22 @@ int _EXFUN(finitef, (float));
> #define __IEEE_DBL_NAN_EXP 0x7ff
> #define __IEEE_FLT_NAN_EXP 0xff
>
> -
> -#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
> - ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
> -
> -#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
> - ((*(long *)&(x) & 0x007fffffL)==0000000000L))
> -
> -#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L))
> +#ifndef __ieeefp_isnanf
> +#define __ieeefp_isnanf(x) (((*(long *)&(x) &
0x7f800000L)==0x7f800000L) && \
> + ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
> +#endif
> +#define isnanf(x) __ieeefp_isnanf(x)
> +
> +#ifndef __ieeefp_isinff
> +#define __ieeefp_isinff(x) (((*(long *)&(x) &
0x7f800000L)==0x7f800000L) && \
> + ((*(long *)&(x) & 0x007fffffL)==0000000000L))
> +#endif
> +#define isinff(x) __ieeefp_isinff(x)
> +
> +#ifndef __ieeefp_finitef
> +#define __ieeefp_finitef(x) (((*(long *)&(x) &
0x7f800000L)!=0x7f800000L))
> +#endif
> +#define finitef(x) __ieeefp_finitef(x)
>
> #ifdef _DOUBLE_IS_32BITS
> #undef __IEEE_DBL_EXPBIAS
Even though you did not touch these macros except to wrap the, with
#ifndef, they violate C/C++ aliasing rules and should be fixed (but this
is a side issue from the patch).
Thanks,
Andrew Pinski