lmp
is a BSD licensed multiprecision integer library.
This library is an experiment towards offering an alternative large integer implementation for the Glasgow Haskell Compiler.
See replacing-gmp-notes for more motivation behind replacing GMP.
Getting a working prototype which implements all functions required by GHC is the primary goal.
The code shall be compliant C99. Compiler intrinsics may be used if supported by both clang and gcc and their use yields a significant benefit. Compiler intrinsics shall be used in favour of switching to assembly language as they maintain architecture independence even if not compiling to efficient primitives on all architectures. Having a single code path executed and tested on all architectures also reduces maintenance burden and the likelyhood of architecture specific bugs.
Performance is nice, but not a primary goal for now. It would be hybris to try to compete with GMP. It is considered good enough to stay in the same algorithmic complexity classes and stay within the same order of magnitude wrt to performance.
C compilers are incredibly smart these days. It shall be assumed that this library is used with recent compiler versions and optimisations turned on.
Some extensions have the potential for massive perfomance gains, but they are not available on all CPUs.
This topic may be explored in a second step unless it's a low hanging fruit (auto-vectorization).
One notable point is that ....
BSD3