Blame mini-gmp/README

Packit 5c3484
Copyright 2011-2013 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
This file is part of the GNU MP Library.
Packit 5c3484
Packit 5c3484
The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
it under the terms of either:
Packit 5c3484
Packit 5c3484
  * the GNU Lesser General Public License as published by the Free
Packit 5c3484
    Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
    option) any later version.
Packit 5c3484
Packit 5c3484
or
Packit 5c3484
Packit 5c3484
  * the GNU General Public License as published by the Free Software
Packit 5c3484
    Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
    later version.
Packit 5c3484
Packit 5c3484
or both in parallel, as here.
Packit 5c3484
Packit 5c3484
The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
for more details.
Packit 5c3484
Packit 5c3484
You should have received copies of the GNU General Public License and the
Packit 5c3484
GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
Packit 5c3484
This is "mini-gmp", a small implementation of a subset of GMP's mpn
Packit 5c3484
and mpz interfaces.
Packit 5c3484
Packit 5c3484
It is intended for applications which need arithmetic on numbers
Packit 5c3484
larger than a machine word, but which don't need to handle very large
Packit 5c3484
numbers very efficiently. Those applications can include a copy of
Packit 5c3484
mini-gmp to get a GMP-compatible interface with small footprint. One
Packit 5c3484
can also arrange for optional linking with the real GMP library, using
Packit 5c3484
mini-gmp as a fallback when for some reason GMP is not available, or
Packit 5c3484
not desired as a dependency.
Packit 5c3484
Packit 5c3484
The supported GMP subset is declared in mini-gmp.h. The implemented
Packit 5c3484
functions are fully compatible with the corresponding GMP functions,
Packit 5c3484
as specified in the GMP manual, with a few exceptions:
Packit 5c3484
Packit 5c3484
  mpz_set_str, mpz_init_set_str, mpz_get_str, mpz_out_str and
Packit 5c3484
  mpz_sizeinbase support only |base| <= 36;
Packit 5c3484
  mpz_export and mpz_import support only NAILS = 0.
Packit 5c3484
Packit 5c3484
  The REALLOC_FUNC and FREE_FUNC registered with
Packit 5c3484
  mp_set_memory_functions does not get the correct size of the
Packit 5c3484
  allocated block in the corresponding argument. mini-gmp always
Packit 5c3484
  passes zero for these rarely used arguments.
Packit 5c3484
Packit 5c3484
The implementation is a single file, mini-gmp.c.
Packit 5c3484
Packit 5c3484
The performance target for mini-gmp is to be at most 10 times slower
Packit 5c3484
than the real GMP library, for numbers of size up to a few hundred
Packit 5c3484
bits. No asymptotically fast algorithms are included in mini-gmp, so
Packit 5c3484
it will be many orders of magnitude slower than GMP for very large
Packit 5c3484
numbers.
Packit 5c3484
Packit 5c3484
You should never "install" mini-gmp. Applications can either just
Packit 5c3484
#include mini-gmp.c (but then, beware that it defines several macros
Packit 5c3484
and functions outside of the advertised interface). Or compile
Packit 5c3484
mini-gmp.c as a separate compilation unit, and use the declarations in
Packit 5c3484
mini-gmp.h.
Packit 5c3484
Packit 5c3484
The tests subdirectory contains a testsuite. To use it, you need GMP
Packit 5c3484
and GNU make. Just run make check in the tests directory. If the
Packit 5c3484
hard-coded compiler settings are not right, you have to either edit the
Packit 5c3484
Makefile or pass overriding values on the make command line (e.g.,
Packit 5c3484
make CC=cc check). Testing is not (yet) as thorough as for the real
Packit 5c3484
GMP.
Packit 5c3484
Packit 5c3484
The current version was put together by Niels Möller
Packit 5c3484
<nisse@lysator.liu.se>, with a fair amount of copy-and-paste from the
Packit 5c3484
GMP sources.