1How to compile GNU MPFR with mini-gmp 2===================================== 3 4To build and test MPFR against mini-gmp: 5 6 ./configure --with-mini-gmp=DIR [other configure options] 7 make 8 make check 9 10where DIR is the directory that contains mini-gmp 11(for example .../gmp-6.2.0/mini-gmp). 12 13"make" will build mini-gmp with the same compiler as for MPFR. 14 15For "make check", tests that use features not supported by mini-gmp 16(mpq_t, mpf_t, and the gmp_*printf functions) are skipped. 17 18Note: To use this version of the MPFR library, you need to define 19the MPFR_USE_MINI_GMP macro before including mpfr.h (alternatively, 20you can modify mpfr.h to define this macro at the beginning, though 21this is discouraged). And since mini-gmp currently does not provide 22random functions, you also need to define the gmp_randstate_t type 23with 24 25 typedef long int gmp_randstate_t[1]; 26 27before including mpfr.h (or you may want to modify mini-gmp.h). 28 29Remark: The random functions provided by MPFR configured with mini-gmp 30use the standard rand() function, thus one should avoid mini-gmp if one 31needs some really serious random functions. Another consequence is that 32these functions may not be thread-safe. 33 34The build with mini-gmp may require ISO C99+ features, such as "long long". 35 36This was tested with revision 39ac9e4 and GMP 6.2.0 on x86_64 GNU/Linux: 37============================================================================ 38Testsuite summary for MPFR 4.1.0-dev 39============================================================================ 40# TOTAL: 183 41# PASS: 172 42# SKIP: 11 43# XFAIL: 0 44# FAIL: 0 45# XPASS: 0 46# ERROR: 0 47============================================================================ 48 49How to use mini-gmp with reduced limb size 50========================================== 51 52Following the idea of Micro-GMP [1], the GMP developers have adapted mini-gmp 53so that it can be used with a reduced limb size. For that, you need GMP 6.2.0 54(or later) and define the MINI_GMP_LIMB_TYPE macro with the associated base 55type, e.g. 56 57 -DMINI_GMP_LIMB_TYPE=char (in practice, 8 bits) 58 -DMINI_GMP_LIMB_TYPE=short (in practice, 16 bits) 59 -DMINI_GMP_LIMB_TYPE=int (in practice, 32 bits) 60 61For example: 62 63 ./configure --with-mini-gmp=DIR CFLAGS="-DMINI_GMP_LIMB_TYPE=int" 64 65This was tested with revision 39ac9e4 and GMP 6.2.0 on x86_64 GNU/Linux: 66============================================================================ 67Testsuite summary for MPFR 4.1.0-dev 68============================================================================ 69# TOTAL: 183 70# PASS: 172 71# SKIP: 11 72# XFAIL: 0 73# FAIL: 0 74# XPASS: 0 75# ERROR: 0 76============================================================================ 77 78[1] https://members.loria.fr/PZimmermann/talks/microgmp.pdf 79