Blob Blame History Raw
2004-10-06  Jakub Jelinek  <jakub@redhat.com>

	* config/os/gnu-linux/bits/os_defines.h: Define
	__glibcpp_{float,double,long_double}* macros.
	* config/cpu/x86-64/bits/cpu_limits.h (__glibcpp_long_bits): Only
	define to 64 if __x86_64__.
	* include/std/std_limits.h (__glibcpp_f*_round_error): Only define
	if not yet defined.

--- libstdc++-v3/config/os/gnu-linux/bits/os_defines.h.jj	2002-06-03 17:33:17.000000000 +0200
+++ libstdc++-v3/config/os/gnu-linux/bits/os_defines.h	2004-10-06 20:07:16.601101686 +0200
@@ -73,4 +73,87 @@ typedef __loff_t __off64_t;
 #define __glibcpp_long_double_bits 64
 #endif
 
+/* RHEL3 hack.  */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__IBMCPP__) \
+    && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__) \
+        || defined(__s390__) || defined(__s390x__) || defined(__powerpc__) \
+        || defined(__powerpc64__))
+#define __glibcpp_float_has_quiet_NaN true
+#define __glibcpp_float_has_signaling_NaN true
+#define __glibcpp_float_has_denorm denorm_present
+#define __glibcpp_float_has_infinity true
+#define __glibcpp_float_round_style round_to_nearest
+#define __glibcpp_float_is_iec559 true
+#define __glibcpp_double_has_quiet_NaN true
+#define __glibcpp_double_has_signaling_NaN true
+#define __glibcpp_double_has_denorm denorm_present
+#define __glibcpp_double_has_infinity true
+#define __glibcpp_double_round_style round_to_nearest
+#define __glibcpp_double_is_iec559 true
+#define __glibcpp_long_double_has_quiet_NaN true
+#define __glibcpp_long_double_has_signaling_NaN true
+#define __glibcpp_long_double_has_denorm denorm_present
+#define __glibcpp_long_double_has_infinity true
+#define __glibcpp_long_double_round_style round_to_nearest
+#define __glibcpp_long_double_is_iec559 true
+
+#define __glibcpp_f32_round_error 0.5F
+#define __glibcpp_f64_round_error 0.5
+#define __glibcpp_f80_round_error 0.5L
+#define __glibcpp_f96_round_error 0.5L
+#define __glibcpp_f128_round_error 0.5L
+
+#define __glibcpp_float_infinity 1.0e+40F
+#define __glibcpp_double_infinity 1.0e+320
+#define __glibcpp_long_double_infinity 1.0e+5000L
+
+#define __glibcpp_float_denorm_min 1.40129846e-45F
+#define __glibcpp_double_denorm_min 4.9406564584124654e-324
+
+#define __glibcpp_float_quiet_NaN \
+  (__extension__ ((union { unsigned int __l; float __d; })		\
+		  { __l: 0x7fc00000 }).__d)
+#define __glibcpp_double_quiet_NaN \
+  (__extension__ ((union { unsigned long long __l; double __d; })	\
+		  { __l: 0x7ff8000000000000ULL }).__d)
+
+#define __glibcpp_float_signaling_NaN \
+  (__extension__ ({ union { unsigned int __l; float __d; } __u;		\
+		    __u.__l = 0x7fa00000;				\
+		    __asm ("" : : "r" (&__u) : "memory"); __u.__d; }))
+#define __glibcpp_double_signaling_NaN \
+  (__extension__ ({ union { unsigned long long __l; double __d; } __u;	\
+		    __u.__l = 0x7ff4000000000000ULL;			\
+		    __asm ("" : : "r" (&__u) : "memory"); __u.__d; }))
+
+#if __glibcpp_long_double_bits == 80
+
+#define __glibcpp_long_double_denorm_min 3.64519953188247460253e-4951L
+#define __glibcpp_long_double_quiet_NaN \
+  (__extension__ ({ union { unsigned long long __l[2];			\
+			    long double __d; } __u;			\
+		    __u.__l[0] = 0xcULL << 60; __u.__l[1] = 0x7fff;	\
+		    __u.__d; }))
+#define __glibcpp_long_double_signaling_NaN \
+  (__extension__ ({ union { unsigned long long __l[2];			\
+			    long double __d; } __u;			\
+		    __u.__l[0] = 0xaULL << 60; __u.__l[1] = 0x7fff;	\
+		    __asm ("" : : "r" (&__u) : "memory"); __u.__d; }))
+
+#else
+
+#define __glibcpp_long_double_denorm_min 4.9406564584124654e-324L
+#define __glibcpp_long_double_quiet_NaN \
+  (__extension__ ((union { unsigned long long __l; long double __d; })	\
+		  { __l: 0x7ff8000000000000ULL }).__d)
+#define __glibcpp_long_double_signaling_NaN \
+  (__extension__ ({ union { unsigned long long __l;			\
+			    long double __d; } __u;			\
+		     __u.__l = 0x7ff4000000000000ULL;			\
+		     __asm ("" : : "r" (&__u) : "memory"); __u.__d; }))
+
+#endif
+
+#endif
+
 #endif
--- libstdc++-v3/config/cpu/x86-64/bits/cpu_limits.h.jj	2002-01-12 23:14:42.000000000 +0100
+++ libstdc++-v3/config/cpu/x86-64/bits/cpu_limits.h	2004-10-06 17:13:39.369189090 +0200
@@ -28,7 +28,9 @@
 #ifndef _GLIBCPP_CPU_LIMITS
 #define _GLIBCPP_CPU_LIMITS 1
 
+#ifdef __x86_64__
 #define __glibcpp_long_bits 64
+#endif
 
 #define __glibcpp_long_double_bits 80
 
--- libstdc++-v3/include/std/std_limits.h.jj	2002-10-16 16:12:23.000000000 +0200
+++ libstdc++-v3/include/std/std_limits.h	2004-10-06 19:59:26.602318867 +0200
@@ -180,7 +180,9 @@
 #define __glibcpp_f32_digits10 6
 #define __glibcpp_f32_radix 2
 #define __glibcpp_f32_epsilon 1.19209290e-07F
+#ifndef __glibcpp_f32_round_error
 #define __glibcpp_f32_round_error 1.0F
+#endif
 #define __glibcpp_f32_min_exponent -125
 #define __glibcpp_f32_min_exponent10 -37
 #define __glibcpp_f32_max_exponent 128
@@ -191,7 +193,9 @@
 #define __glibcpp_f64_digits10 15
 #define __glibcpp_f64_radix 2
 #define __glibcpp_f64_epsilon 2.2204460492503131e-16
+#ifndef __glibcpp_f64_round_error
 #define __glibcpp_f64_round_error 1.0
+#endif
 #define __glibcpp_f64_min_exponent -1021
 #define __glibcpp_f64_min_exponent10 -307
 #define __glibcpp_f64_max_exponent 1024
@@ -202,7 +206,9 @@
 #define __glibcpp_f80_digits10 18
 #define __glibcpp_f80_radix 2
 #define __glibcpp_f80_epsilon 1.08420217248550443401e-19L
+#ifndef __glibcpp_f80_round_error
 #define __glibcpp_f80_round_error 1.0L
+#endif
 #define __glibcpp_f80_min_exponent -16381
 #define __glibcpp_f80_min_exponent10 -4931
 #define __glibcpp_f80_max_exponent 16384
@@ -213,7 +219,9 @@
 #define __glibcpp_f96_digits10 18
 #define __glibcpp_f96_radix 2
 #define __glibcpp_f96_epsilon 1.08420217248550443401e-19L
+#ifndef __glibcpp_f96_round_error
 #define __glibcpp_f96_round_error 1.0L
+#endif
 #define __glibcpp_f96_min_exponent -16382
 #define __glibcpp_f96_min_exponent10 -4931
 #define __glibcpp_f96_max_exponent 16384
@@ -224,7 +232,9 @@
 #define __glibcpp_f128_digits10 33
 #define __glibcpp_f128_radix 2
 #define __glibcpp_f128_epsilon 1.925929944387235853055977942584927319E-34L
+#ifndef __glibcpp_f128_round_error
 #define __glibcpp_f128_round_error 1.0L
+#endif
 #define __glibcpp_f128_min_exponent -16381
 #define __glibcpp_f128_min_exponent10 -4931
 #define __glibcpp_f128_max_exponent 16384