Index: ChangeLog =================================================================== RCS file: /cvs/src/src/newlib/ChangeLog,v retrieving revision 1.1361 diff -u -p -r1.1361 ChangeLog --- ChangeLog 9 Jun 2009 11:33:56 -0000 1.1361 +++ ChangeLog 12 Jun 2009 23:30:22 -0000 @@ -1,3 +1,10 @@ +2009-06-12 Craig Howland + + * libc/include/math.h: Simplify fpclassify, isinf, isnan, and signbit + macros to remove un-necessary extension use. isinf and isnan also + changed to use fpclassify. isfinite macro modified to run faster by + only calling fpclassify once instead of possibly twice. + 2009-06-09 Corinna Vinschen * libc/ctype/tolower.c (tolower): Cast conversion result from Index: libc/include/math.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/math.h,v retrieving revision 1.41 diff -u -p -r1.41 math.h --- libc/include/math.h 15 May 2009 16:15:57 -0000 1.41 +++ libc/include/math.h 12 Jun 2009 23:30:22 -0000 @@ -181,14 +181,14 @@ extern int __fpclassifyd (double x); extern int __signbitf (float x); extern int __signbitd (double x); -#define fpclassify(x) \ - (__extension__ ({__typeof__(x) __x = (x); \ - (sizeof (__x) == sizeof (float)) ? __fpclassifyf(__x) : __fpclassifyd(__x);})) +#define fpclassify(__x) \ + ((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \ + __fpclassifyd(__x)) #ifndef isfinite -#define isfinite(y) \ - (__extension__ ({__typeof__(y) __y = (y); \ - fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;})) + #define isfinite(__y) \ + (__extension__ ({int __cy = fpclassify(__y); \ + __cy != FP_INFINITE && __cy != FP_NAN;})) #endif /* Note: isinf and isnan were once functions in newlib that took double @@ -197,21 +197,17 @@ extern int __signbitd (double x); * now defined as macros. Implementations of the old functions * taking double arguments still exist for compatibility purposes. */ #ifndef isinf -#define isinf(x) \ - (__extension__ ({__typeof__(x) __x = (x); \ - (sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);})) + #define isinf(y) (fpclassify(y) == FP_INFINITE) #endif #ifndef isnan -#define isnan(x) \ - (__extension__ ({__typeof__(x) __x = (x); \ - (sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);})) + #define isnan(y) (fpclassify(y) == FP_NAN) #endif #define isnormal(y) (fpclassify(y) == FP_NORMAL) -#define signbit(x) \ - (__extension__ ({__typeof__(x) __x = (x); \ - (sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);})) +#define signbit(__x) \ + ((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \ + __signbitd(__x)) #define isgreater(x,y) \ (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \