[Gmp-commit] /var/hg/gmp: Use udiv_qrnnd also in sparc64-specific code

mercurial at gmplib.org mercurial at gmplib.org
Tue Mar 1 12:00:35 CET 2011


details:   /var/hg/gmp/rev/e603a7068402
changeset: 13955:e603a7068402
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Tue Mar 01 12:00:32 2011 +0100
description:
Use udiv_qrnnd also in sparc64-specific code

diffstat:

 ChangeLog             |   7 +++++++
 mpn/sparc64/mod_1_4.c |  12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 4b030fea06d6 -r e603a7068402 ChangeLog
--- a/ChangeLog	Tue Mar 01 10:02:38 2011 +0100
+++ b/ChangeLog	Tue Mar 01 12:00:32 2011 +0100
@@ -1,3 +1,10 @@
+2011-03-01  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpn/sparc64/mod_1_4.c (mpn_mod_1s_4p_cps): Converted to use
+	udiv_rnnd_preinv rather than udiv_rnd_preinv.
+	(mpn_mod_1s_4p): Use udiv_rnnd_preinv rather than
+	udiv_qrnnd_preinv.
+
 2011-03-01  Torbjorn Granlund  <tege at gmplib.org>
 
 	* gmp-impl.h (udiv_qrnnd_preinv3): Cast truth value to mask's type.
diff -r 4b030fea06d6 -r e603a7068402 mpn/sparc64/mod_1_4.c
--- a/mpn/sparc64/mod_1_4.c	Tue Mar 01 10:02:38 2011 +0100
+++ b/mpn/sparc64/mod_1_4.c	Tue Mar 01 12:00:32 2011 +0100
@@ -48,10 +48,10 @@
 
   B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt));
   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
-  udiv_rnd_preinv (B2modb, B1modb, b, bi);
-  udiv_rnd_preinv (B3modb, B2modb, b, bi);
-  udiv_rnd_preinv (B4modb, B3modb, b, bi);
-  udiv_rnd_preinv (B5modb, B4modb, b, bi);
+  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
+  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
+  udiv_rnnd_preinv (B5modb, B4modb, 0, b, bi);
 
   cps[0] = bi;
   cps[1] = cnt;
@@ -77,7 +77,7 @@
 mp_limb_t
 mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
 {
-  mp_limb_t rh, rl, bi, q, ph, pl, ch, cl, r;
+  mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
   mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
   mp_size_t i;
   int cnt;
@@ -215,7 +215,7 @@
   cnt = cps[1];
 
   r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
-  udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi);
+  udiv_rnnd_preinv (r, r, rl << cnt, b, bi);
 
   return r >> cnt;
 }


More information about the gmp-commit mailing list