about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf_fp.c13
-rw-r--r--stdio-common/printf_fphex.c10
-rw-r--r--stdio-common/printf_size.c19
3 files changed, 17 insertions, 25 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 3023b20183..11f3145b3a 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -332,7 +332,6 @@ ___printf_fp (FILE *fp,
       fpnum.ldbl = *(const long double *) args[0];
 
       /* Check for special values: not a number or infinity.  */
-      int res;
       if (isnan (fpnum.ldbl))
 	{
 	  is_neg = signbit (fpnum.ldbl);
@@ -347,9 +346,9 @@ ___printf_fp (FILE *fp,
 		wspecial = L"nan";
 	      }
 	}
-      else if ((res = __isinfl (fpnum.ldbl)))
+      else if (isinf (fpnum.ldbl))
 	{
-	  is_neg = res < 0;
+	  is_neg = signbit (fpnum.ldbl);
 	  if (isupper (info->spec))
 	    {
 	      special = "INF";
@@ -377,11 +376,9 @@ ___printf_fp (FILE *fp,
       fpnum.dbl = *(const double *) args[0];
 
       /* Check for special values: not a number or infinity.  */
-      int res;
       if (isnan (fpnum.dbl))
 	{
-	  union ieee754_double u = { .d = fpnum.dbl };
-	  is_neg = u.ieee.negative != 0;
+	  is_neg = signbit (fpnum.dbl);
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";
@@ -393,9 +390,9 @@ ___printf_fp (FILE *fp,
 	      wspecial = L"nan";
 	    }
 	}
-      else if ((res = __isinf (fpnum.dbl)))
+      else if (isinf (fpnum.dbl))
 	{
-	  is_neg = res < 0;
+	  is_neg = signbit (fpnum.dbl);
 	  if (isupper (info->spec))
 	    {
 	      special = "INF";
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index 6c3b5e9723..0627beaacf 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -180,7 +180,7 @@ __printf_fphex (FILE *fp,
 	}
       else
 	{
-	  if (__isinfl (fpnum.ldbl))
+	  if (isinf (fpnum.ldbl))
 	    {
 	      if (isupper (info->spec))
 		{
@@ -204,7 +204,6 @@ __printf_fphex (FILE *fp,
       /* Check for special values: not a number or infinity.  */
       if (isnan (fpnum.dbl.d))
 	{
-	  negative = fpnum.dbl.ieee.negative != 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";
@@ -218,8 +217,7 @@ __printf_fphex (FILE *fp,
 	}
       else
 	{
-	  int res = __isinf (fpnum.dbl.d);
-	  if (res)
+	  if (isinf (fpnum.dbl.d))
 	    {
 	      if (isupper (info->spec))
 		{
@@ -231,11 +229,9 @@ __printf_fphex (FILE *fp,
 		  special = "inf";
 		  wspecial = L"inf";
 		}
-	      negative = res < 0;
 	    }
-	  else
-	    negative = signbit (fpnum.dbl.d);
 	}
+      negative = signbit (fpnum.dbl.d);
     }
 
   if (special)
diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
index 7dcd58e0d8..216f1707d6 100644
--- a/stdio-common/printf_size.c
+++ b/stdio-common/printf_size.c
@@ -108,7 +108,7 @@ __printf_size (FILE *fp, const struct printf_info *info,
   fpnum;
   const void *ptr = &fpnum;
 
-  int fpnum_sign = 0;
+  int is_neg = 0;
 
   /* "NaN" or "Inf" for the special cases.  */
   const char *special = NULL;
@@ -117,7 +117,6 @@ __printf_size (FILE *fp, const struct printf_info *info,
   struct printf_info fp_info;
   int done = 0;
   int wide = info->wide;
-  int res;
 
   /* Fetch the argument value.	*/
 #ifndef __NO_LONG_DOUBLE_MATH
@@ -130,11 +129,11 @@ __printf_size (FILE *fp, const struct printf_info *info,
 	{
 	  special = "nan";
 	  wspecial = L"nan";
-	  // fpnum_sign = 0;	Already zero
+	  // is_neg = 0;	Already zero
 	}
-      else if ((res = __isinfl (fpnum.ldbl)))
+      else if (isinf (fpnum.ldbl))
 	{
-	  fpnum_sign = res;
+	  is_neg = signbit (fpnum.ldbl);
 	  special = "inf";
 	  wspecial = L"inf";
 	}
@@ -155,11 +154,11 @@ __printf_size (FILE *fp, const struct printf_info *info,
 	{
 	  special = "nan";
 	  wspecial = L"nan";
-	  // fpnum_sign = 0;	Already zero
+	  // is_neg = 0;	Already zero
 	}
-      else if ((res = __isinf (fpnum.dbl.d)))
+      else if (isinf (fpnum.dbl.d))
 	{
-	  fpnum_sign = res;
+	  is_neg = signbit (fpnum.dbl.d);
 	  special = "inf";
 	  wspecial = L"inf";
 	}
@@ -175,14 +174,14 @@ __printf_size (FILE *fp, const struct printf_info *info,
     {
       int width = info->prec > info->width ? info->prec : info->width;
 
-      if (fpnum_sign < 0 || info->showsign || info->space)
+      if (is_neg || info->showsign || info->space)
 	--width;
       width -= 3;
 
       if (!info->left && width > 0)
 	PADN (' ', width);
 
-      if (fpnum_sign < 0)
+      if (is_neg)
 	outchar ('-');
       else if (info->showsign)
 	outchar ('+');