[Gmp-commit] /var/hg/gmp: 4 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sun Sep 27 05:45:47 UTC 2015


details:   /var/hg/gmp/rev/84cdddd92a11
changeset: 16830:84cdddd92a11
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Sep 27 06:58:37 2015 +0200
description:
mpz/cfdiv_r_2exp.c: Use mpn_neg and MPZ_NEWALLOC.

details:   /var/hg/gmp/rev/8617414ff316
changeset: 16831:8617414ff316
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Sep 27 07:02:05 2015 +0200
description:
mpz/cfdiv_q_2exp.c: Use MPZ_REALLOC return value.

details:   /var/hg/gmp/rev/ee4e4ac5e7d2
changeset: 16832:ee4e4ac5e7d2
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Sep 27 07:02:47 2015 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/7e89761ccc37
changeset: 16833:7e89761ccc37
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Sep 27 07:45:29 2015 +0200
description:
tests/mp?/Makefile.am (check_PROGRAMS); Reorder tests.

diffstat:

 ChangeLog             |   5 +++++
 mpz/cfdiv_q_2exp.c    |   7 +++----
 mpz/cfdiv_r_2exp.c    |  10 +++-------
 tests/mpf/Makefile.am |   2 +-
 tests/mpn/Makefile.am |   4 ++--
 tests/mpz/Makefile.am |   4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diffs (117 lines):

diff -r 6659bc3f7541 -r 7e89761ccc37 ChangeLog
--- a/ChangeLog	Tue Sep 15 08:56:04 2015 +0200
+++ b/ChangeLog	Sun Sep 27 07:45:29 2015 +0200
@@ -1,3 +1,8 @@
+2015-09-27 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/cfdiv_r_2exp.c: Use mpn_neg and MPZ_NEWALLOC.
+	* mpz/cfdiv_q_2exp.c: Use MPZ_REALLOC return value.
+
 2015-09-12  Torbjörn Granlund  <torbjorng at google.com>
 
 	* tests/mpf/t-cmp_si.c (check_data): Set precision reflecting data.
diff -r 6659bc3f7541 -r 7e89761ccc37 mpz/cfdiv_q_2exp.c
--- a/mpz/cfdiv_q_2exp.c	Tue Sep 15 08:56:04 2015 +0200
+++ b/mpz/cfdiv_q_2exp.c	Sun Sep 27 07:45:29 2015 +0200
@@ -1,7 +1,7 @@
 /* mpz_cdiv_q_2exp, mpz_fdiv_q_2exp -- quotient from mpz divided by 2^n.
 
-Copyright 1991, 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2004, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2004, 2012,
+2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -59,7 +59,7 @@
     }
 
   /* +1 limb to allow for mpn_add_1 below */
-  MPZ_REALLOC (w, wsize+1);
+  wp = MPZ_REALLOC (w, wsize+1);
 
   /* Check for rounding if direction matches u sign.
      Set round if we're skipping non-zero limbs.  */
@@ -70,7 +70,6 @@
     for (i = 0; i < limb_cnt && round == 0; i++)
       round = up[i];
 
-  wp = PTR(w);
   cnt %= GMP_NUMB_BITS;
   if (cnt != 0)
     {
diff -r 6659bc3f7541 -r 7e89761ccc37 mpz/cfdiv_r_2exp.c
--- a/mpz/cfdiv_r_2exp.c	Tue Sep 15 08:56:04 2015 +0200
+++ b/mpz/cfdiv_r_2exp.c	Sun Sep 27 07:45:29 2015 +0200
@@ -73,12 +73,12 @@
 	  /* if already smaller than limb_cnt then do nothing */
 	  if (abs_usize <= limb_cnt)
 	    return;
-	  wp = PTR(w);
+	  wp = up;
 	}
       else
 	{
 	  i = MIN (abs_usize, limb_cnt+1);
-	  wp = MPZ_REALLOC (w, i);
+	  wp = MPZ_NEWALLOC (w, i);
 	  MPN_COPY (wp, up, i);
 
 	  /* if smaller than limb_cnt then only the copy is needed */
@@ -118,14 +118,10 @@
 
       /* Ones complement */
       i = MIN (abs_usize, limb_cnt+1);
-      mpn_com (wp, up, i);
+      ASSERT_CARRY (mpn_neg (wp, up, i));
       for ( ; i <= limb_cnt; i++)
 	wp[i] = GMP_NUMB_MAX;
 
-      /* Twos complement.  Since u!=0 in the relevant part, the twos
-	 complement never gives 0 and a carry, so can use MPN_INCR_U. */
-      MPN_INCR_U (wp, limb_cnt+1, CNST_LIMB(1));
-
       usize = -usize;
     }
 
diff -r 6659bc3f7541 -r 7e89761ccc37 tests/mpf/Makefile.am
--- a/tests/mpf/Makefile.am	Tue Sep 15 08:56:04 2015 +0200
+++ b/tests/mpf/Makefile.am	Sun Sep 27 07:45:29 2015 +0200
@@ -21,7 +21,7 @@
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
 LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
 
-check_PROGRAMS = t-add t-sub t-conv t-sqrt t-sqrt_ui t-muldiv t-dm2exp reuse \
+check_PROGRAMS = t-dm2exp t-conv t-add t-sub t-sqrt t-sqrt_ui t-muldiv reuse \
   t-cmp_d t-cmp_si t-div t-fits t-get_d t-get_d_2exp \
   t-get_si t-get_ui t-gsprec t-inp_str t-int_p t-mul_ui \
   t-set t-set_q t-set_si t-set_ui t-trunc t-ui_div t-eq
diff -r 6659bc3f7541 -r 7e89761ccc37 tests/mpn/Makefile.am
--- a/tests/mpn/Makefile.am	Tue Sep 15 08:56:04 2015 +0200
+++ b/tests/mpn/Makefile.am	Sun Sep 27 07:45:29 2015 +0200
@@ -26,8 +26,8 @@
   t-toom22 t-toom32 t-toom33 t-toom42 t-toom43 t-toom44			\
   t-toom52 t-toom53 t-toom54 t-toom62 t-toom63 t-toom6h t-toom8h	\
   t-toom2-sqr t-toom3-sqr t-toom4-sqr t-toom6-sqr t-toom8-sqr		\
-  t-mul t-mullo t-sqrlo t-mulmod_bnm1 t-sqrmod_bnm1 t-mulmid		\
-  t-hgcd t-hgcd_appr t-matrix22 t-invert t-div t-bdiv			\
+  t-div t-mul t-mullo t-sqrlo t-mulmod_bnm1 t-sqrmod_bnm1 t-mulmid	\
+  t-hgcd t-hgcd_appr t-matrix22 t-invert t-bdiv				\
   t-broot t-brootinv t-minvert t-sizeinbase
 
 EXTRA_DIST = toom-shared.h toom-sqr-shared.h
diff -r 6659bc3f7541 -r 7e89761ccc37 tests/mpz/Makefile.am
--- a/tests/mpz/Makefile.am	Tue Sep 15 08:56:04 2015 +0200
+++ b/tests/mpz/Makefile.am	Sun Sep 27 07:45:29 2015 +0200
@@ -21,9 +21,9 @@
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
 LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
 
-check_PROGRAMS = t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv   \
+check_PROGRAMS = reuse t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv \
   t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm t-invert dive dive_ui t-sqrtrem \
-  convert io t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse   \
+  convert io t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp      \
   t-root t-perfsqr t-perfpow t-jac t-bin t-get_d t-get_d_2exp t-get_si	\
   t-set_d t-set_si							\
   t-fac_ui t-mfac_uiui t-primorial_ui t-fib_ui t-lucnum_ui t-scan t-fits   \


More information about the gmp-commit mailing list