gcd_22
Torbjörn Granlund
tg at gmplib.org
Mon Aug 26 14:36:26 UTC 2019
I wonder if not something like this,
for (;;) {
if (up[N-1] < vp[N-1])
swap up,vp
back:
cy = mpn_sub_n (up, up, vp, N);
if (UNLIKELY (cy)) { swap up,vp; goto back }
if (UNLIKELY (up[0] == 0)) {
// handle any number zeros including that U = 0
}
count_trailing_zeros (cnt, up[0]);
mpn_rshift (up, up, N, cnt);
}
would fit between our gcd_NN and the hgcd2 code?
The calls to mpn_sub_n and mpn_rshift should probably really be inlined
for specific values of N, but generic code for variable N might also be
useful.
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-devel
mailing list