_mp_alloc to long int

Paul Zimmermann Paul.Zimmermann at inria.fr
Mon Aug 22 17:11:25 CEST 2022

> From: Roman Savelyev <rsavelyev at wlu.ca>
> Thread-Topic: _mp_alloc to long int
> Thread-Index: AQHYo23PcvMGd5LgN0yv6fOgqbtKKg==
> Date: Fri, 29 Jul 2022 17:12:18 +0000
> A project I am working on, requires more than 2^37 limbs, more than a 64 bit system would allow, if mp_alloc is set to int. When I manually change it to long int, recompile and run, I get a segmentation fault, particularly in mpz_set_ui through gmpxx. Would you be willing to shine a light on what needs to change within the program to make it possible to make this change?
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss

in gmp-h.in, change the _mp_alloc and _mp_size fields from 'int' to 'long';
in mpz/init2.c, change 'int' to 'long' on line 43, and INT_MAX to LONG_MAX
2 lines later, and do similar changes in mpz/realloc.c and mpz/realloc2.c.

This is the "gmp enterprise" patch from my colleague Emmanuel Thomé


More information about the gmp-discuss mailing list