[Gmp-commit] /home/hgfiles/gmp: Use udiv_qr_3by2 also in mpn_sbpi1_divappr_q
mercurial at gmplib.org
mercurial at gmplib.org
Mon Dec 14 22:50:57 CET 2009
details: /home/hgfiles/gmp/rev/a5f71c37c4c7
changeset: 13077:a5f71c37c4c7
user: Niels M?ller <nisse at lysator.liu.se>
date: Mon Dec 14 22:37:31 2009 +0100
description:
Use udiv_qr_3by2 also in mpn_sbpi1_divappr_q
diffstat:
ChangeLog | 5 ++
mpn/generic/sbpi1_divappr_q.c | 80 +-----------------------------------------
2 files changed, 8 insertions(+), 77 deletions(-)
diffs (120 lines):
diff -r 9f43674c7499 -r a5f71c37c4c7 ChangeLog
--- a/ChangeLog Mon Dec 14 20:16:04 2009 +0100
+++ b/ChangeLog Mon Dec 14 22:37:31 2009 +0100
@@ -1,3 +1,8 @@
+2009-12-14 Niels Möller <nisse at lysator.liu.se>
+
+ * mpn/generic/sbpi1_divappr_q.c (mpn_sbpi1_divappr_q): Use
+ udiv_qr_3by2.
+
2009-12-14 Torbjorn Granlund <tege at gmplib.org>
* tune/tuneup.c (tune_binvert): Remove BINV_MULMOD_BNM1_THRESHOLD
diff -r 9f43674c7499 -r a5f71c37c4c7 mpn/generic/sbpi1_divappr_q.c
--- a/mpn/generic/sbpi1_divappr_q.c Mon Dec 14 20:16:04 2009 +0100
+++ b/mpn/generic/sbpi1_divappr_q.c Mon Dec 14 22:37:31 2009 +0100
@@ -84,30 +84,7 @@
}
else
{
- umul_ppmm (q, q0, n1, dinv);
- add_ssaaaa (q, q0, q, q0, n1, np[1]);
-
- /* Compute the two most significant limbs of n - q'd */
- n1 = np[1] - d1 * q;
- n0 = np[0];
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- umul_ppmm (t1, t0, d0, q);
- sub_ddmmss (n1, n0, n1, n0, t1, t0);
- q++;
-
- /* Conditionally adjust q and the remainders */
- mask = - (mp_limb_t) (n1 >= q0);
- q += mask;
- add_ssaaaa (n1, n0, n1, n0, mask & d1, mask & d0);
-
- if (UNLIKELY (n1 >= d1))
- {
- if (n1 > d1 || n0 >= d0)
- {
- q++;
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- }
- }
+ udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
cy = mpn_submul_1 (np - dn, dp, dn, q);
@@ -153,30 +130,7 @@
}
else
{
- umul_ppmm (q, q0, n1, dinv);
- add_ssaaaa (q, q0, q, q0, n1, np[1]);
-
- /* Compute the two most significant limbs of n - q'd */
- n1 = np[1] - d1 * q;
- n0 = np[0];
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- umul_ppmm (t1, t0, d0, q);
- sub_ddmmss (n1, n0, n1, n0, t1, t0);
- q++;
-
- /* Conditionally adjust q and the remainders */
- mask = - (mp_limb_t) (n1 >= q0);
- q += mask;
- add_ssaaaa (n1, n0, n1, n0, mask & d1, mask & d0);
-
- if (UNLIKELY (n1 >= d1))
- {
- if (n1 > d1 || n0 >= d0)
- {
- q++;
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- }
- }
+ udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
cy = mpn_submul_1 (np - dn, dp, dn, q);
@@ -220,39 +174,11 @@
}
else
{
- umul_ppmm (q, q0, n1, dinv);
- add_ssaaaa (q, q0, q, q0, n1, np[1]);
-
- /* Compute the two most significant limbs of n - q'd */
- n1 = np[1] - d1 * q;
- n0 = np[0];
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- umul_ppmm (t1, t0, d0, q);
- sub_ddmmss (n1, n0, n1, n0, t1, t0);
- q++;
-
- /* Conditionally adjust q and the remainders */
- mask = - (mp_limb_t) (n1 >= q0);
- q += mask;
- add_ssaaaa (n1, n0, n1, n0, mask & d1, mask & d0);
-
- if (UNLIKELY (n1 >= d1))
- {
- if (n1 > d1 || n0 >= d0)
- {
- q++;
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- }
- }
-
- np[0] = n0;
- np[1] = n1;
+ udiv_qr_3by2 (q, np[1], np[0], n1, np[1], np[0], d1, d0, dinv);
}
*--qp = q;
}
- ASSERT_ALWAYS (np[1] == n1);
- np += 2;
return qh;
}
More information about the gmp-commit
mailing list