Paul Eggert wrote:
> diff --git a/lib/gcd.c b/lib/gcd.c
> index d208f12d3c..d7a336364b 100644
> --- a/lib/gcd.c
> +++ b/lib/gcd.c
> @@ -42,7 +42,8 @@ GCD (WORD_T a, WORD_T b)
>
> WORD_T c = a | b;
> c = c ^ (c - 1);
> - /* c = largest power of 2 that divides a and b. */
> + /* c = p + (p - 1), where p is the largest power of 2 that
> + divides both a and b. */
>
> if (a & c)
> {
>
Thanks. More comment fixes are needed:
2026-07-28 Paul Eggert <[email protected]>
Bruno Haible <[email protected]>
gcd: Fix comments.
* lib/gcd.c (GCD): Fix comments.
diff --git a/lib/gcd.c b/lib/gcd.c
index d7a336364b..700a8899ee 100644
--- a/lib/gcd.c
+++ b/lib/gcd.c
@@ -62,13 +62,13 @@ GCD (WORD_T a, WORD_T b)
for (;;)
{
- odd_odd: /* a/c and b/c both odd */
+ odd_odd: /* a/p and b/p both odd */
if (a == b)
break;
if (a > b)
{
a = a - b;
- even_odd: /* a/c even, b/c odd */
+ even_odd: /* a/p even, b/p odd */
do
a = a >> 1;
while ((a & c) == 0);
@@ -76,7 +76,7 @@ GCD (WORD_T a, WORD_T b)
else
{
b = b - a;
- odd_even: /* a/c odd, b/c even */
+ odd_even: /* a/p odd, b/p even */
do
b = b >> 1;
while ((b & c) == 0);