[Gmp-commit] /var/hg/gmp: mini-mpq: s/8/CHAR_BIT/

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 9 13:57:30 UTC 2020


details:   /var/hg/gmp/rev/dfe3af2d796c
changeset: 18007:dfe3af2d796c
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 09 14:51:14 2020 +0100
description:
mini-mpq: s/8/CHAR_BIT/

diffstat:

 mini-gmp/mini-mpq.c           |  2 +-
 mini-gmp/tests/t-mpq_double.c |  5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 969e9ac22378 -r dfe3af2d796c mini-gmp/mini-mpq.c
--- a/mini-gmp/mini-mpq.c	Fri Jan 03 22:31:00 2020 +0100
+++ b/mini-gmp/mini-mpq.c	Thu Jan 09 14:51:14 2020 +0100
@@ -454,7 +454,7 @@
   ne = mpz_sizeinbase (mpq_numref (u), 2);
   de = mpz_sizeinbase (mpq_denref (u), 2);
 
-  ee = 8 * sizeof (double);
+  ee = CHAR_BIT * sizeof (double);
   if (de == 1 || ne > de + ee)
     ee = 0;
   else
diff -r 969e9ac22378 -r dfe3af2d796c mini-gmp/tests/t-mpq_double.c
--- a/mini-gmp/tests/t-mpq_double.c	Fri Jan 03 22:31:00 2020 +0100
+++ b/mini-gmp/tests/t-mpq_double.c	Thu Jan 09 14:51:14 2020 +0100
@@ -19,6 +19,7 @@
 
 #include <math.h>
 #include <float.h>
+#include <limits.h>
 
 #include "testutils.h"
 #include "../mini-mpq.h"
@@ -87,7 +88,7 @@
       unsigned long m;
       int e, c;
 
-      mini_rrandomb (x, 8 * sizeof (unsigned long));
+      mini_rrandomb (x, CHAR_BIT * sizeof (unsigned long));
       m = mpz_get_ui (x);
       mini_urandomb (x, 8);
       e = mpz_get_ui (x) - 128;
@@ -119,7 +120,7 @@
 	  abort ();
 	}
 
-      mini_rrandomb (x, 8 * sizeof (unsigned long));
+      mini_rrandomb (x, CHAR_BIT * sizeof (unsigned long));
       m = mpz_get_ui (x);
       mini_urandomb (x, 8);
       e = mpz_get_ui (x) - 128;


More information about the gmp-commit mailing list