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 POSIX lrand48() and srand48() functions (the platform needs to 31provide them), thus one should avoid mini-gmp if one needs some really 32serious random functions. Another consequence is that these functions 33are not thread-safe. 34 35This was tested with MPFR svn r13974 and GMP 6.2.0 on x86_64 GNU/Linux: 36============================================================================ 37Testsuite summary for MPFR 4.1.0-dev 38============================================================================ 39# TOTAL: 183 40# PASS: 172 41# SKIP: 11 42# XFAIL: 0 43# FAIL: 0 44# XPASS: 0 45# ERROR: 0 46============================================================================ 47 48How to use mini-gmp with reduced limb size 49========================================== 50 51Following the idea of Micro-GMP [1], the GMP developers have adapted mini-gmp 52so that it can be used with a reduced limb size. For that, you need GMP 6.2.0 53(or later) and define the MINI_GMP_LIMB_TYPE macro with the associated base 54type, e.g. 55 56 -DMINI_GMP_LIMB_TYPE=char (in practice, 8 bits) 57 -DMINI_GMP_LIMB_TYPE=short (in practice, 16 bits) 58 -DMINI_GMP_LIMB_TYPE=int (in practice, 32 bits) 59 60For example: 61 62 ./configure --with-mini-gmp=DIR CFLAGS="-DMINI_GMP_LIMB_TYPE=int" 63 64This was tested with MPFR svn r13974 and GMP 6.2.0 on x86_64 GNU/Linux: 65============================================================================ 66Testsuite summary for MPFR 4.1.0-dev 67============================================================================ 68# TOTAL: 183 69# PASS: 172 70# SKIP: 11 71# XFAIL: 0 72# FAIL: 0 73# XPASS: 0 74# ERROR: 0 75============================================================================ 76 77[1] https://members.loria.fr/PZimmermann/talks/microgmp.pdf 78