"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes: >> ! #define GCDEXT_CHECK2(i1, i2) do { \ >> ! mpz_gcdext (res1, res2, NULL, i1, i2); \ >> ! MPZ_CHECK_FORMAT (res1); \ >> ! MPZ_CHECK_FORMAT (res2); \ >> ! if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) \ >> ! FAIL2 (mpz_gcdext, i1, i2, NULL); \ >> ! } while (0) > > Should we check both mpz_gcdext (res1, res2, NULL, i1, i2); and mpz_gcdext > (res1, NULL, res2, i2, i1) in this macro?
Hmm, you changed the code to not only allow G to be NULL, but allow NULL S too? I think that's unnecessary. As you say, mpz_gcdext(G, NULL, NULL, A, B) is better done as mpz_gcd(G, A, B), and mpz_gcdext(*, NULL, T, A, B) is equivalent to mpz_gcdext(*, T, NULL, B, A). (Maybe in the latter case, return value can differ in some corner case, so I'm not sure it's 100% equivalent, but in general swapping the inputs A and B implies swapping of the S and T outputs). So allowing NULL S adds more cases to implement and test, with no gain in functionality. > Since we currently support NULL also for the first argument, should we > check also the cases > mpz_gcdext (NULL, x, y, x, y); > mpz_gcdext (NULL, y, x, x, y); > mpz_gcdext (NULL, s, y, x, y); mpz_gcdext (NULL, y, t, y, x); > mpz_gcdext (NULL, s, x, x, y); mpz_gcdext (NULL, x, t, y, x); > mpz_gcdext (NULL, NULL, y, x, y); mpz_gcdext (NULL, x, NULL, x, y); ^ > mpz_gcdext (NULL, NULL, x, x, y); mpz_gcdext (NULL, y, NULL, x, y); ? ^ Maybe, except for the above two. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel