1Copyright 2011-2013 Free Software Foundation, Inc. 2 3This file is part of the GNU MP Library. 4 5The GNU MP Library is free software; you can redistribute it and/or modify 6it under the terms of either: 7 8 * the GNU Lesser General Public License as published by the Free 9 Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12or 13 14 * the GNU General Public License as published by the Free Software 15 Foundation; either version 2 of the License, or (at your option) any 16 later version. 17 18or both in parallel, as here. 19 20The GNU MP Library is distributed in the hope that it will be useful, but 21WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23for more details. 24 25You should have received copies of the GNU General Public License and the 26GNU Lesser General Public License along with the GNU MP Library. If not, 27see https://www.gnu.org/licenses/. 28 29 30This is "mini-gmp", a small implementation of a subset of GMP's mpn 31and mpz interfaces. 32 33It is intended for applications which need arithmetic on numbers 34larger than a machine word, but which don't need to handle very large 35numbers very efficiently. Those applications can include a copy of 36mini-gmp to get a GMP-compatible interface with small footprint. One 37can also arrange for optional linking with the real GMP library, using 38mini-gmp as a fallback when for some reason GMP is not available, or 39not desired as a dependency. 40 41The supported GMP subset is declared in mini-gmp.h. The implemented 42functions are fully compatible with the corresponding GMP functions, 43as specified in the GMP manual, with a few exceptions: 44 45 mpz_set_str, mpz_init_set_str, mpz_get_str, mpz_out_str and 46 mpz_sizeinbase support only |base| <= 36; 47 mpz_export and mpz_import support only NAILS = 0. 48 49 The REALLOC_FUNC and FREE_FUNC registered with 50 mp_set_memory_functions does not get the correct size of the 51 allocated block in the corresponding argument. mini-gmp always 52 passes zero for these rarely used arguments. 53 54The implementation is a single file, mini-gmp.c. 55 56The performance target for mini-gmp is to be at most 10 times slower 57than the real GMP library, for numbers of size up to a few hundred 58bits. No asymptotically fast algorithms are included in mini-gmp, so 59it will be many orders of magnitude slower than GMP for very large 60numbers. 61 62You should never "install" mini-gmp. Applications can either just 63#include mini-gmp.c (but then, beware that it defines several macros 64and functions outside of the advertised interface). Or compile 65mini-gmp.c as a separate compilation unit, and use the declarations in 66mini-gmp.h. 67 68The tests subdirectory contains a testsuite. To use it, you need GMP 69and GNU make. Just run make check in the tests directory. If the 70hard-coded compiler settings are not right, you have to either edit the 71Makefile or pass overriding values on the make command line (e.g., 72make CC=cc check). Testing is not (yet) as thorough as for the real 73GMP. 74 75The current version was put together by Niels Möller 76<nisse@lysator.liu.se>, with a fair amount of copy-and-paste from the 77GMP sources. 78