Syed Jafri <[email protected]> writes:

> https://github.com/jafri/gmp-bug

To make it easy to follow the example, I would suggest simplifying it to
something like

#include <stdio.h>
#include <gmp.h>  /* or #include "mini-gmp.c" */

int main (int argc, char **argv) 
{
  mpz_t a, b, g, s;

  mpz_init_set_str(a, ...);
  mpz_init_set_str(b, ...);
  mpz_init (g);
  mpz_init (s);
  mpz_gcdext (g, s, NULL, a, b);
  gmp_printf ("g = %Zd, s = %Zd\n", g, s);
  return 0;
}

Never access internal fields of mpz_t directly. If for any reason (this
example has no good reason, as far as I see) one needs to use a limb
array as input, use mpz_roinit_n.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
gmp-bugs mailing list
[email protected]
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to