[Gmp-commit] /var/hg/gmp: Use NEG_CAST

mercurial at gmplib.org mercurial at gmplib.org
Sun May 6 17:10:49 UTC 2018


details:   /var/hg/gmp/rev/5fe1ac7e745c
changeset: 17620:5fe1ac7e745c
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun May 06 19:10:34 2018 +0200
description:
Use NEG_CAST

diffstat:

 mpf/fits_s.h        |  2 +-
 mpn/generic/get_d.c |  2 +-
 scanf/doscan.c      |  2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 110bcd4c29f4 -r 5fe1ac7e745c mpf/fits_s.h
--- a/mpf/fits_s.h	Sun May 06 08:48:36 2018 +0200
+++ b/mpf/fits_s.h	Sun May 06 19:10:34 2018 +0200
@@ -67,5 +67,5 @@
   else
     return 0;
 
-  return fl <= (fs >= 0 ? (mp_limb_t) MAXIMUM : - (mp_limb_t) MINIMUM);
+  return fl <= (fs >= 0 ? (mp_limb_t) MAXIMUM : NEG_CAST (mp_limb_t, MINIMUM));
 }
diff -r 110bcd4c29f4 -r 5fe1ac7e745c mpn/generic/get_d.c
--- a/mpn/generic/get_d.c	Sun May 06 08:48:36 2018 +0200
+++ b/mpn/generic/get_d.c	Sun May 06 19:10:34 2018 +0200
@@ -384,7 +384,7 @@
       else
 	{
 	  weight = 0.5;
-	  uexp = 1 - (unsigned long) (exp + 1);
+	  uexp = NEG_CAST (unsigned long, exp);
 	}
 #if 1
       /* Square-and-multiply exponentiation.  */
diff -r 110bcd4c29f4 -r 5fe1ac7e745c scanf/doscan.c
--- a/scanf/doscan.c	Sun May 06 08:48:36 2018 +0200
+++ b/scanf/doscan.c	Sun May 06 19:10:34 2018 +0200
@@ -401,7 +401,7 @@
 	      if (exp >= 0)
 		mpf_mul_2exp (f, f, (unsigned long) exp);
 	      else
-		mpf_div_2exp (f, f, - (unsigned long) exp);
+		mpf_div_2exp (f, f, NEG_CAST (unsigned long, exp));
 	    }
 	}
 	break;


More information about the gmp-commit mailing list