mpn_gcd[ext] interface details

Niels Möller nisse at
Sat May 14 11:55:08 CEST 2011

nisse at (Niels Möller) writes:

> I'm looking at gmp-4.2.4 now.
> According to the ASSERTs, mpn_gcd required
> both inputs U and V normalized, usize >= vsize >= 1, and V odd. And in
> addition, that bitsize(U) >= bitsize(V).
> And mpn_gcdext required both inputs normalized, and usize >= vsize >= 1.
> So I think normalization has been required for a long time.

And another conclusion is that if we require U >= V (a documented
requirement for gcdext, both for the current implementation and for
gmp-4.2.4) for mpn_gcd, we break backwards compatibility.

So I'm now leaning towrds the following, for both mpn_gcd and

  un >= vn, V normalized

Does this make sense? Am I missing something? Is it important to drop
the old requirement that U is normalized, or should we keep that?


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list