[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Mon Feb 28 17:20:05 CET 2011
details: /var/hg/gmp/rev/e335008b8175
changeset: 13940:e335008b8175
user: Niels M?ller <nisse at lysator.liu.se>
date: Mon Feb 28 16:53:59 2011 +0100
description:
Use udiv_rnnd_preinv
details: /var/hg/gmp/rev/4828d99fcfb3
changeset: 13941:4828d99fcfb3
user: Niels M?ller <nisse at lysator.liu.se>
date: Mon Feb 28 16:54:52 2011 +0100
description:
Deleted udiv_rnd_preinv
diffstat:
ChangeLog | 5 +++++
gmp-impl.h | 12 ------------
mpn/generic/pre_mod_1.c | 3 +--
3 files changed, 6 insertions(+), 14 deletions(-)
diffs (63 lines):
diff -r ff7cd9c674da -r 4828d99fcfb3 ChangeLog
--- a/ChangeLog Mon Feb 28 16:46:37 2011 +0100
+++ b/ChangeLog Mon Feb 28 16:54:52 2011 +0100
@@ -1,5 +1,8 @@
2011-02-28 Niels Möller <nisse at lysator.liu.se>
+ * mpn/generic/pre_mod_1.c (mpn_preinv_mod_1): Use udiv_rnnd_preinv
+ rather than udiv_qrnnd_preinv.
+
* mpn/generic/mod_1_1.c (mpn_mod_1_1p_cps): Converted to use
udiv_rnnd_preinv rather than udiv_rnd_preinv.
(mpn_mod_1_1p): Use udiv_rnnd_preinv rather than
@@ -28,6 +31,8 @@
using masking logic. Further optimization of the nl == constant 0
case, similar to udiv_rnd_preinv.
(udiv_rnnd_preinv): Likewise.
+ (udiv_rnd_preinv): Deleted, use udiv_rnnd_preinv with nl == 0
+ instead.
* tests/mpn/t-divrem_1.c (check_data): Added testcase to exercise
the nl == constant 0 special case in udiv_qrnnd_preinv3.
diff -r ff7cd9c674da -r 4828d99fcfb3 gmp-impl.h
--- a/gmp-impl.h Mon Feb 28 16:46:37 2011 +0100
+++ b/gmp-impl.h Mon Feb 28 16:54:52 2011 +0100
@@ -2823,18 +2823,6 @@
(r) = _r; \
} while (0)
-/* FIXME: Obsolete? Use udiv_rnnd_preinv(r, nh, 0, d, di) instead. */
-/* Compute r = nh*B mod d, where di is the inverse of d. */
-#define udiv_rnd_preinv(r, nh, d, di) \
- do { \
- mp_limb_t _qh, _ql, _r; \
- umul_ppmm (_qh, _ql, (nh), (di)); \
- _r = ~(_qh + (nh)) * (d); \
- if (_r > _ql) \
- _r += (d); \
- (r) = _r; \
- } while (0)
-
/* Compute quotient the quotient and remainder for n / d. Requires d
>= B^2 / 2 and n < d B. di is the inverse
diff -r ff7cd9c674da -r 4828d99fcfb3 mpn/generic/pre_mod_1.c
--- a/mpn/generic/pre_mod_1.c Mon Feb 28 16:46:37 2011 +0100
+++ b/mpn/generic/pre_mod_1.c Mon Feb 28 16:54:52 2011 +0100
@@ -34,7 +34,6 @@
{
mp_size_t i;
mp_limb_t n0, r;
- mp_limb_t dummy;
ASSERT (un >= 1);
ASSERT (d & GMP_LIMB_HIGHBIT);
@@ -46,7 +45,7 @@
for (i = un - 2; i >= 0; i--)
{
n0 = up[i];
- udiv_qrnnd_preinv (dummy, r, r, n0, d, dinv);
+ udiv_rnnd_preinv (r, r, n0, d, dinv);
}
return r;
}
More information about the gmp-commit
mailing list