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-14 03:25:06 +0300
committerJeff Johnston <jjohnstn@redhat.com>2000-12-14 03:25:06 +0300
commitb6182a09dd286f592f2968c324cb2ce36f5b9082 (patch)
treed5fe53f33018bfa8b1194c5165e815aea1cee9ae /newlib/libc/stdio
parentadbbb0348ccebe74a0dbb93307a6d3f96b757fc0 (diff)
2000-12-13 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/ldtoa.c (_ldcheck): New routine that categorizes a long double as NaN, Infinity, or other. * libc/stdio/vfprintf.c [WANT_IO_LONG_DBL](_VFPRINTF_R): Removed isinfl and isnanl static routines which were i386-specific. Changed calls to the two removed routines to a single _ldcheck call. * libc/stdio/vfieeefp.h (ldieee): Fixed missing semi-colons.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/vfieeefp.h10
-rw-r--r--newlib/libc/stdio/vfprintf.c35
2 files changed, 10 insertions, 35 deletions
diff --git a/newlib/libc/stdio/vfieeefp.h b/newlib/libc/stdio/vfieeefp.h
index de0267223..1b240fcde 100644
--- a/newlib/libc/stdio/vfieeefp.h
+++ b/newlib/libc/stdio/vfieeefp.h
@@ -70,7 +70,7 @@ struct ldieee
unsigned manh:23;
unsigned exp:8;
unsigned sign:1;
-}
+};
#elif LDBL_MANT_DIG == 53
struct ldieee
{
@@ -78,7 +78,7 @@ struct ldieee
unsigned manh:32;
unsigned exp:11;
unsigned sign:1;
-}
+};
#elif LDBL_MANT_DIG == 64
struct ldieee
{
@@ -105,7 +105,7 @@ struct ldieee
unsigned sign:1;
unsigned exp:8;
unsigned manh:23;
-}
+};
#elif LDBL_MANT_DIG == 53
struct ldieee
{
@@ -113,7 +113,7 @@ struct ldieee
unsigned exp:11;
unsigned manh:32;
unsigned manl:20;
-}
+};
#elif LDBL_MANT_DIG == 64
struct ldieee
{
@@ -121,7 +121,7 @@ struct ldieee
unsigned exp:15;
unsigned manh:32;
unsigned manl:32;
-}
+};
#elif LDBL_MANT_DIG > 64
struct ldieee
{
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 306644a30..34ec68972 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -252,8 +252,7 @@ __sbprintf(fp, fmt, ap)
static char *cvt _PARAMS((struct _reent *, double, int, int, char *, int *, int, int *));
#else
static char *cvt _PARAMS((struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
-static int isinfl _PARAMS((_LONG_DOUBLE *));
-static int isnanl _PARAMS((_LONG_DOUBLE *));
+extern int _ldcheck _PARAMS((_LONG_DOUBLE *));
#endif
static int exponent _PARAMS((char *, int, int));
@@ -322,6 +321,7 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
#else
union { int i; _LONG_DOUBLE ld; } _long_double_ = {0};
#define _fpvalue (_long_double_.ld)
+ int tmp;
#endif
int expt; /* integer value of exponent */
int expsize = 0; /* character count for expstr */
@@ -604,14 +604,15 @@ reswitch: switch (ch) {
}
/* do this before tricky precision changes */
- if (isinfl(&_fpvalue)) {
+ tmp = _ldcheck (&_fpvalue);
+ if (tmp == 2) {
if (_fpvalue < 0)
sign = '-';
cp = "Inf";
size = 3;
break;
}
- if (isnanl(&_fpvalue)) {
+ if (tmp == 1) {
cp = "NaN";
size = 3;
break;
@@ -912,32 +913,6 @@ extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int,
int, int *, int *, char **));
#undef word0
#define word0(x) ldword0(x)
-
-static int
-isinfl (value)
- _LONG_DOUBLE *value;
-{
- struct ldieee *ldptr;
-
- ldptr = (struct ldieee *)value;
-
- if (ldptr->exp == 0x7fff && !(ldptr->manh & 0x7fffffff) && !ldptr->manl)
- return 1;
- return 0;
-}
-
-static int
-isnanl (value)
- _LONG_DOUBLE *value;
-{
- struct ldieee *ldptr;
-
- ldptr = (struct ldieee *)value;
-
- if (ldptr->exp == 0x7fff && ((ldptr->manh & 0x7fffffff) || ldptr->manl))
- return 1;
- return 0;
-}
#endif
static char *