GMP 6.1.0 release candidate available

Niels Möller nisse at
Fri Oct 30 04:26:13 UTC 2015

"Marco Bodrato" <bodrato at> writes:

>> * mini-gmp.c still does not provide gmp_version
>> * mini-gmp.h still does not provide __GNU_MP_VERSION,
> mini-gmp is not GMP... it can not mimic all the features of the main
> library, and it can not pretend it is equivalent to any given version of
> the library...

I agreem mini-gmp shouldn't try to mimic gmp to that level of detail. It
would make some sense to define gmp_version, though, but to a
*different* string than the corresponding real gmp.

> No *rand* supported by mini-gmp,

And I don't think it should. Do you have any use case where you need
sophisticated (but non-cryptographic) random numbers *and* it makes
sense to use mini-gmp?

> About GMP_NUMB_BITS, no configure step is provided for mini-gmp, and using
> a formula (like #define GMP_NUMB_BITS (8*sizeof(mp_limb_t)) ) is not
> coherent with the definition in gmp.h ...

In many cases,

  #include <limits.h>
  #define GMP_NUMB_BITS (CHAR_BIT * sizeof(mp_limb_t))

is a working substitute. But unlike in the real gmp, it's not a
preprocessor constant. If you need that, I recommend a configure test

  if test "x$enable_mini_gmp" = "xyes" ; then
    AC_MSG_CHECKING([for mini-gmp limb size])
    # With mini-gmp, mp_limb_t is always unsigned long.
    AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [(sizeof(unsigned long) * CHAR_BIT)],
        [#include <limits.h>],
        [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])])

    AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits])


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list