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 _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel