[Gmp-commit] /var/hg/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Feb 2 15:10:00 UTC 2020
details: /var/hg/gmp/rev/2a398323c9c7
changeset: 18029:2a398323c9c7
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Feb 02 16:04:20 2020 +0100
description:
mini-gmp/mini-gmp.c (gmp_jacobi_coprime): Exit condition on a.
details: /var/hg/gmp/rev/45f8cabff208
changeset: 18030:45f8cabff208
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Feb 02 16:05:30 2020 +0100
description:
mpn/generic/powlo.c: Better handling of current window-size.
details: /var/hg/gmp/rev/a1bfb342ebe9
changeset: 18031:a1bfb342ebe9
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Feb 02 16:05:45 2020 +0100
description:
mpn/generic/powm.c: Better handling of current window-size.
details: /var/hg/gmp/rev/2624648aa8e1
changeset: 18032:2624648aa8e1
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Feb 02 16:06:52 2020 +0100
description:
ChangeLog
diffstat:
ChangeLog | 5 +++++
mini-gmp/ChangeLog | 4 ++++
mini-gmp/mini-gmp.c | 6 +++---
mpn/generic/powlo.c | 12 ++++++------
mpn/generic/powm.c | 21 ++++++---------------
5 files changed, 24 insertions(+), 24 deletions(-)
diffs (157 lines):
diff -r 6c062a1cad34 -r 2624648aa8e1 ChangeLog
--- a/ChangeLog Fri Jan 31 18:11:13 2020 +0100
+++ b/ChangeLog Sun Feb 02 16:06:52 2020 +0100
@@ -1,3 +1,8 @@
+2020-02-02 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * mpn/generic/powm.c: Better handling of current window-size.
+ * mpn/generic/powlo.c: Likewise.
+
2020-01-31 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mpn/generic/powm.c (MPN_REDC_0): Subtractive redc
diff -r 6c062a1cad34 -r 2624648aa8e1 mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog Fri Jan 31 18:11:13 2020 +0100
+++ b/mini-gmp/ChangeLog Sun Feb 02 16:06:52 2020 +0100
@@ -1,3 +1,7 @@
+2020-02-02 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c (gmp_jacobi_coprime): Exit condition on a.
+
2019-12-04 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mini-gmp/mini-gmp.c (mpn_invert_3by2): Remove shortcuts.
diff -r 6c062a1cad34 -r 2624648aa8e1 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Fri Jan 31 18:11:13 2020 +0100
+++ b/mini-gmp/mini-gmp.c Sun Feb 02 16:06:52 2020 +0100
@@ -3357,6 +3357,8 @@
bit ^= c & (b ^ (b >> 1));
if (a < b)
{
+ if (a == 0)
+ return bit & 1 ? -1 : 1;
bit ^= a & b;
a = b - a;
b -= a;
@@ -3370,9 +3372,7 @@
gmp_ctz(c, a);
++c;
}
- while (b > 0);
-
- return bit & 1 ? -1 : 1;
+ while (1);
}
static void
diff -r 6c062a1cad34 -r 2624648aa8e1 mpn/generic/powlo.c
--- a/mpn/generic/powlo.c Fri Jan 31 18:11:13 2020 +0100
+++ b/mpn/generic/powlo.c Sun Feb 02 16:06:52 2020 +0100
@@ -1,6 +1,7 @@
/* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base.
-Copyright 2007-2009, 2012, 2015, 2016, 2018 Free Software Foundation, Inc.
+Copyright 2007-2009, 2012, 2015, 2016, 2018, 2020 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -43,7 +44,7 @@
mp_limb_t r;
mp_size_t i;
- if (bi < nbits)
+ if (bi <= nbits)
{
return p[0] & (((mp_limb_t) 1 << bi) - 1);
}
@@ -56,7 +57,7 @@
nbits_in_r = GMP_NUMB_BITS - bi; /* number of bits now in r */
if (nbits_in_r < nbits) /* did we get enough bits? */
r += p[i + 1] << nbits_in_r; /* prepend bits from higher word */
- return r & (((mp_limb_t ) 1 << nbits) - 1);
+ return r & (((mp_limb_t) 1 << nbits) - 1);
}
}
@@ -121,10 +122,10 @@
} while (--i != 0);
expbits = getbits (ep, ebi, windowsize);
+ ebi -= windowsize;
/* THINK: Should we initialise the case expbits % 4 == 0 with a mullo? */
count_trailing_zeros (cnt, expbits);
- ebi -= windowsize;
ebi += cnt;
expbits >>= cnt;
@@ -156,11 +157,10 @@
expbits = getbits (ep, ebi, windowsize);
this_windowsize = MIN (windowsize, ebi);
- ebi -= this_windowsize;
count_trailing_zeros (cnt, expbits);
this_windowsize -= cnt;
- ebi += cnt;
+ ebi -= this_windowsize;
expbits >>= cnt;
while (this_windowsize > 1)
diff -r 6c062a1cad34 -r 2624648aa8e1 mpn/generic/powm.c
--- a/mpn/generic/powm.c Fri Jan 31 18:11:13 2020 +0100
+++ b/mpn/generic/powm.c Sun Feb 02 16:06:52 2020 +0100
@@ -6,7 +6,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2007-2012, 2019 Free Software Foundation, Inc.
+Copyright 2007-2012, 2019, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -142,7 +142,7 @@
mp_limb_t r;
mp_size_t i;
- if (bi < nbits)
+ if (bi <= nbits)
{
return p[0] & (((mp_limb_t) 1 << bi) - 1);
}
@@ -682,11 +682,9 @@
}
expbits = getbits (ep, ebi, windowsize);
- if (ebi < windowsize)
- ebi = 0;
- else
- ebi -= windowsize;
+ ebi -= windowsize;
+ /* THINK: Should we initialise the case expbits % 4 == 0 with a mul? */
count_trailing_zeros (cnt, expbits);
ebi += cnt;
expbits >>= cnt;
@@ -709,18 +707,11 @@
significant bit is 1. */ \
\
expbits = getbits (ep, ebi, windowsize); \
- this_windowsize = windowsize; \
- if (ebi < windowsize) \
- { \
- this_windowsize -= windowsize - ebi; \
- ebi = 0; \
- } \
- else \
- ebi -= windowsize; \
+ this_windowsize = MIN (ebi, windowsize); \
\
count_trailing_zeros (cnt, expbits); \
this_windowsize -= cnt; \
- ebi += cnt; \
+ ebi -= this_windowsize; \
expbits >>= cnt; \
\
do \
More information about the gmp-commit
mailing list