summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2010-12-14 11:16:16 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2010-12-14 11:16:16 +0000
commit7435b3779589be6d0dad67fd1842b6efec367719 (patch)
tree85fb86f3b8a67cbad40dc87f19639d7ea4a06379 /include
parentb8dd9dd528434b0ffadaca571f1b36e4b1b34e23 (diff)
- make HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, NAN expand to the
constant expressions with the help of gcc post-3.3. ok millert@, mikeb@. been in snaps for weeks.
Diffstat (limited to 'include')
-rw-r--r--include/math.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/math.h b/include/math.h
index 2d9d4333110..c03e466c0dd 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math.h,v 1.26 2009/07/25 11:38:09 martynas Exp $ */
+/* $OpenBSD: math.h,v 1.27 2010/12/14 11:16:15 martynas Exp $ */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -25,7 +25,11 @@
* ANSI/POSIX
*/
extern char __infinity[];
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VAL __builtin_huge_val()
+#else /* __GNUC_PREREQ__(3, 3) */
#define HUGE_VAL (*(double *)(void *)__infinity)
+#endif /* __GNUC_PREREQ__(3, 3) */
/*
* C99
@@ -34,6 +38,12 @@ extern char __infinity[];
typedef __double_t double_t;
typedef __float_t float_t;
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VALF __builtin_huge_valf()
+#define HUGE_VALL __builtin_huge_vall()
+#define INFINITY __builtin_inff()
+#define NAN __builtin_nanf("")
+#else /* __GNUC_PREREQ__(3, 3) */
#ifdef __vax__
extern char __infinityf[];
#define HUGE_VALF (*(float *)(void *)__infinityf)
@@ -46,6 +56,7 @@ extern char __infinityf[];
extern char __nan[];
#define NAN (*(float *)(void *)__nan)
#endif /* !__vax__ */
+#endif /* __GNUC_PREREQ__(3, 3) */
#define FP_INFINITE 0x01
#define FP_NAN 0x02