This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]