2009-06-16 Craig Howland <howland@LGSInnovations.com>
* 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.
This commit is contained in:
parent
bc95c37690
commit
aa201fc9df
|
@ -1,3 +1,10 @@
|
||||||
|
2009-06-16 Craig Howland <howland@LGSInnovations.com>
|
||||||
|
|
||||||
|
* 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 <corinna@vinschen.de>
|
2009-06-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* libc/ctype/tolower.c (tolower): Cast conversion result from
|
* libc/ctype/tolower.c (tolower): Cast conversion result from
|
||||||
|
|
|
@ -181,14 +181,14 @@ extern int __fpclassifyd (double x);
|
||||||
extern int __signbitf (float x);
|
extern int __signbitf (float x);
|
||||||
extern int __signbitd (double x);
|
extern int __signbitd (double x);
|
||||||
|
|
||||||
#define fpclassify(x) \
|
#define fpclassify(__x) \
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
|
||||||
(sizeof (__x) == sizeof (float)) ? __fpclassifyf(__x) : __fpclassifyd(__x);}))
|
__fpclassifyd(__x))
|
||||||
|
|
||||||
#ifndef isfinite
|
#ifndef isfinite
|
||||||
#define isfinite(y) \
|
#define isfinite(__y) \
|
||||||
(__extension__ ({__typeof__(y) __y = (y); \
|
(__extension__ ({int __cy = fpclassify(__y); \
|
||||||
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
|
__cy != FP_INFINITE && __cy != FP_NAN;}))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Note: isinf and isnan were once functions in newlib that took double
|
/* 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
|
* now defined as macros. Implementations of the old functions
|
||||||
* taking double arguments still exist for compatibility purposes. */
|
* taking double arguments still exist for compatibility purposes. */
|
||||||
#ifndef isinf
|
#ifndef isinf
|
||||||
#define isinf(x) \
|
#define isinf(y) (fpclassify(y) == FP_INFINITE)
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
|
||||||
(sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);}))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef isnan
|
#ifndef isnan
|
||||||
#define isnan(x) \
|
#define isnan(y) (fpclassify(y) == FP_NAN)
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
|
||||||
(sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);}))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define isnormal(y) (fpclassify(y) == FP_NORMAL)
|
#define isnormal(y) (fpclassify(y) == FP_NORMAL)
|
||||||
#define signbit(x) \
|
#define signbit(__x) \
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
|
||||||
(sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))
|
__signbitd(__x))
|
||||||
|
|
||||||
#define isgreater(x,y) \
|
#define isgreater(x,y) \
|
||||||
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
||||||
|
|
Loading…
Reference in New Issue