summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2012-02-10 21:27:50 +0100
committerNiels Möller <nisse@lysator.liu.se>2012-02-10 21:27:50 +0100
commit8ec68d2785194ef763968bfe738aeb9e25a99a08 (patch)
tree3ade122328dfab34518c70f9feb2b2c9b2e509f6
parent09ebd63c90b4661c878278104b1cc24ca44f0650 (diff)
downloadgmp-8ec68d2785194ef763968bfe738aeb9e25a99a08.tar.gz
mpn_gcdext_hook: Added comment.
-rw-r--r--mpn/generic/gcdext_lehmer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mpn/generic/gcdext_lehmer.c b/mpn/generic/gcdext_lehmer.c
index 911a676bc..e2a1707bc 100644
--- a/mpn/generic/gcdext_lehmer.c
+++ b/mpn/generic/gcdext_lehmer.c
@@ -94,6 +94,13 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn,
if (u1n == 0)
return;
+ /* Should always have u1n == un here, and u1 >= u0. The
+ reason is that we alternate adding u0 to u1 and u1 to u0
+ (corresponding to subtractions a - b and b - a), and we
+ can get a large quotient only just after a switch, which
+ means that we'll add (a multiple of) the larger u to the
+ smaller. */
+
tp = ctx->tp;
if (qn > u1n)