mini-gmp

Vincent Lefevre vincent at vinc17.net
Sun Dec 16 01:22:27 UTC 2018


On 2018-12-15 20:18:44 +0100, Niels Möller wrote:
> Vincent Lefevre <vincent at vinc17.net> writes:
> 
> > Yes, this is expected by MPFR. But since mini-gmp.c includes
> > mini-gmp.h, this prevents one from redefining GMP_LIMB_BITS
> > in mini-gmp.h, except by exactly the same content, which is
> > not interesting.
> 
> I'm afraid I'm missing simthing. Why would you redefine it in
> mini-gmp.h? Since it's now *not* in mini-gmp.h, you can define
> GMP_LIMB_BITS elsewhere in mpfr, without colliding.

This was a suggestion by Paul:

------------------------------------------------------------------
How to use mini-gmp with reduced limb size
==========================================

Following the idea of Micro-GMP [1], the GMP developers have adapted mini-gmp
so that it can be used with a reduced limb size.

For that, you have to take a GMP snapshot from December 09, 2018, or later
(see https://gmplib.org/download/snapshot/).

Then edit the first line of mini-gmp.h to have for example:

  #include <stdint.h>
  typedef uint8_t mp_limb_t;
  #define GMP_LIMB_BITS 8
  #define __GMP_SHORT_LIMB

Then you can configure MPFR with that version of mini-gmp, as indicated above.
------------------------------------------------------------------

> > #ifndef GMP_LIMB_BITS
> > #define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
> > #endif
> 
> To be clear, are you suggesting this is added in mini-gmp.h or in
> mini-gmp.c?

mini-gmp.c

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list