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>2000-12-07 02:50:11 +0300
committerJeff Johnston <jjohnstn@redhat.com>2000-12-07 02:50:11 +0300
commit6bdac416e9e1aecfb94cd3ae383889cc7b7e62e3 (patch)
tree0871ae257bee23aa786ad2ac43aeb3470d340f5f /newlib/libc/stdio/vfieeefp.h
parent81e615de9818b0094abea875b60ca955edfcec9c (diff)
2000-12-06 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/Makefile.am: Added ldtoa.c to list of sources. * libc/stdlib/Makefile.in: Regenerated. * libc/stdio/floatio.h: Added suitable MAXEXP for long double. * libc/stdio/vfieeefp.h: Added long double bit structures. * libc/stdio/vfprintf.c[WANT_IO_LONG_DBL]: Added long double support. [WANT_IO_LONG_DBL](isinfl, isnanl): New static long double routines. (exponent): Changed expbuf to reasonable maximum instead of MAXEXP. * libc/stdio/vfscanf.c[WANT_IO_LONG_DBL]: Added long double support. * libc/stdlib/ldtoa.c: New file containing _ldtoa_r and _strtold routines used for conversions between character and long double.
Diffstat (limited to 'newlib/libc/stdio/vfieeefp.h')
-rw-r--r--newlib/libc/stdio/vfieeefp.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/newlib/libc/stdio/vfieeefp.h b/newlib/libc/stdio/vfieeefp.h
index 6843d5f47..de0267223 100644
--- a/newlib/libc/stdio/vfieeefp.h
+++ b/newlib/libc/stdio/vfieeefp.h
@@ -57,6 +57,85 @@
Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
#endif
+#ifdef WANT_IO_LONG_DBL
+/* If we are going to examine or modify specific bits in a long double using
+ the lword0 or lwordx macros, then we must wrap the long double inside
+ a union. This is necessary to avoid undefined behavior according to
+ the ANSI C spec. */
+
+#ifdef IEEE_8087
+#if LDBL_MANT_DIG == 24
+struct ldieee
+{
+ unsigned manh:23;
+ unsigned exp:8;
+ unsigned sign:1;
+}
+#elif LDBL_MANT_DIG == 53
+struct ldieee
+{
+ unsigned manl:20;
+ unsigned manh:32;
+ unsigned exp:11;
+ unsigned sign:1;
+}
+#elif LDBL_MANT_DIG == 64
+struct ldieee
+{
+ unsigned manl:32;
+ unsigned manh:32;
+ unsigned exp:15;
+ unsigned sign:1;
+};
+#elif LDBL_MANT_DIG > 64
+struct ldieee
+{
+ unsigned manl3:16;
+ unsigned manl2:32;
+ unsigned manl:32;
+ unsigned manh:32;
+ unsigned exp:15;
+ unsigned sign:1;
+};
+#endif /* LDBL_MANT_DIG */
+#else /* !IEEE_8087 */
+#if LDBL_MANT_DIG == 24
+struct ldieee
+{
+ unsigned sign:1;
+ unsigned exp:8;
+ unsigned manh:23;
+}
+#elif LDBL_MANT_DIG == 53
+struct ldieee
+{
+ unsigned sign:1;
+ unsigned exp:11;
+ unsigned manh:32;
+ unsigned manl:20;
+}
+#elif LDBL_MANT_DIG == 64
+struct ldieee
+{
+ unsigned sign:1;
+ unsigned exp:15;
+ unsigned manh:32;
+ unsigned manl:32;
+}
+#elif LDBL_MANT_DIG > 64
+struct ldieee
+{
+ unsigned sign:1;
+ unsigned exp:15;
+ unsigned manh:32;
+ unsigned manl:32;
+ unsigned manl2:32;
+ unsigned manl3;16;
+};
+#endif /* LDBL_MANT_DIG */
+#endif /* !IEEE_8087 */
+#endif /* WANT_IO_LONG_DBL */
+
/* If we are going to examine or modify specific bits in a double using
the word0 and/or word1 macros, then we must wrap the double inside
a union. This is necessary to avoid undefined behavior according to