aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2006-06-12 22:22:18 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2006-06-12 22:22:18 +0000
commita4c5a5dc71f7f545137dd26565484d573ac7d2ba (patch)
tree8ddbe1ed889baf71f4946dd6bd90c8e2041652b2
parenta91cc828ccea75e24b254d1214f1f61b0cc8bdfa (diff)
downloadnewlib-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.zip
newlib-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.tar.gz
newlib-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.tar.bz2
* include/math.h (HUGE_VAL): Define as builtin if __GNUC__ >= 3.3,
else global library variable. (HUGEVALF): Likewise; (HUGEVALL): Likewise. (INFINITY): Likewise. (NAN): LiKewise.
-rw-r--r--winsup/mingw/ChangeLog9
-rw-r--r--winsup/mingw/include/math.h22
2 files changed, 28 insertions, 3 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index ab937a7..35c5dde 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,5 +1,14 @@
2006-06-13 Danny Smith <dannysmith@users.sourceforge.net>
+ * include/math.h (HUGE_VAL): Define as builtin if __GNUC__ >= 3.3,
+ else global library variable.
+ (HUGEVALF): Likewise;
+ (HUGEVALL): Likewise.
+ (INFINITY): Likewise.
+ (NAN): LiKewise.
+
+2006-06-13 Danny Smith <dannysmith@users.sourceforge.net>
+
* mingwex/wcrtomb.c (wcrtomb_cp): Correct typo.
2006-06-13 Danny Smith <dannysmith@users.sourceforge.net>
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
index 1bd9b16..0da7869 100644
--- a/winsup/mingw/include/math.h
+++ b/winsup/mingw/include/math.h
@@ -101,6 +101,10 @@ extern "C" {
* NOTE: The CRTDLL version uses _HUGE_dll instead.
*/
+#if __MINGW_GNUC_PREREQ(3, 3)
+#define HUGE_VAL __builtin_huge_val()
+#else
+
#ifndef __DECLSPEC_SUPPORTED
#ifdef __MSVCRT__
@@ -124,6 +128,8 @@ __MINGW_IMPORT double _HUGE_dll;
#endif
#endif /* __DECLSPEC_SUPPORTED */
+#endif /* __MINGW_GNUC_PREREQ(3, 3) */
+
struct _exception
{
@@ -283,10 +289,20 @@ _CRTIMP int __cdecl _set_SSE2_enable (int);
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| !defined __STRICT_ANSI__ || defined __cplusplus
-#define HUGE_VALF 0x1.0p255f
-#define HUGE_VALL 0x1.0p32767L
+#if __MINGW_GNUC_PREREQ(3, 3)
+#define HUGE_VALF __builtin_huge_valf()
+#define HUGE_VALL __builtin_huge_vall()
+#define INFINITY __builtin_inf()
+#define NAN __builtin_nan("")
+#else
+#extern const float __INFF;
+#define HUGE_VALF __INFF
+#extern const long double __INFL;
+#define HUGE_VALL __INFL
#define INFINITY HUGE_VALF
-#define NAN (HUGE_VALF - HUGE_VALF)
+extern const double __QNAN;
+#define NAN __QNAN
+#endif /* __MINGW_GNUC_PREREQ(3, 3) */
/* 7.12.3.1 */
/*