Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2009-06-16 19:55:06 +0400
committerJeff Johnston <jjohnstn@redhat.com>2009-06-16 19:55:06 +0400
commitaa201fc9dfa772b005755214b6b96a27d4d7a2f9 (patch)
treec356ed9cd9ac215fe24486be595275bcdb73d101
parentbc95c37690bcca6ea0960b29b5d806f43be6a5da (diff)
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.
-rw-r--r--newlib/ChangeLog7
-rw-r--r--newlib/libc/include/math.h26
2 files changed, 18 insertions, 15 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index d501fe600..ef829ef53 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -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>
* libc/ctype/tolower.c (tolower): Cast conversion result from
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index f25539a2f..ca65a44b2 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -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); \