nisse at lysator.liu.se
Wed Dec 6 18:53:04 UTC 2017
paul zimmermann <Paul.Zimmermann at inria.fr> writes:
> However, we are still missing a proper (documented) way to distinguish
> mini-gmp from plain gmp. We could use the __MINI_GMP_H__ macro but it is not
We could add some documented macro for this purpse, but I'm not sure I
understand why you need it. In nettle, I do things like this:
AC_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of
if test "x$enable_mini_gmp" = xyes ; then
Then in version.h.in (which is subject to configure substitutions, and
unlike config.h, nettle/version.h is a public header file):
#define NETTLE_USE_MINI_GMP @NETTLE_USE_MINI_GMP@
Finally, in bignum.h,
# include "mini-gmp.h"
/* Any other min--gmp-specific hacks */
# include <gmp.h>
And then I have a couple of #if NETTLE_USE_MINI_GMP spread out in the
rest of the code.
> And I notice that very few of the division functions from mini-gmp correspond
> to those of the GMP documentation. Thus to compile MPFR with mini-gmp we had
> to re-implement mpn_divrem_1, mpn_divrem and mpn_tdiv_qr. We can contribute
> them to mini-gmp if you want.
mini-gmp.h doesn't declare any mpn_*div functions. The mpn division
interface in GMP needs some work, and the code in mini-gmp is closer in
spirit to the new division functions we worked on (must be a decade
ago!), which still haven't made it to the public GMP api.
For compatibility, it would make some sense to add more of the public
mpn division functions to mini-gmp, if they can be done as reasonably
simple wrappers around the existing functions.
> The other functions we had to re-implement are some random functions
> (using srand48/lrand48, thus generating different random sequences, but
> for MPFR this is fine),
Right, I think sophisticated random numbers is out-of-scope for
> and finally mpz_dump.
Hmm. It seems this function is declared in gmp.h, but not mentioned in
the manual, and with a discouraging comment at the top of mpz/dump.c.
Any reason you can't switch to always use mpz_out_str instead?
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel