I don't think you will find any decent big integer C library, that not use malloc
, calloc
and possibly realloc
or whatever dynamic allocation, because the whole point of arbitrary precision numbers is to go beyond limited, platform-dependent stack size and for second it's much more flexible method than compile-time static memory allocation.
My guess is to adapt mini-gmp
package to overcome your specific limitations. (you will find it under main directory along with some tests). It contains one header file and C-source file, so it should be a lot simpler to "cut-off" libc
dependency rather than fully-featured release, however it will be not that fast as GMP relies heavily on highly-optimized assembly code for various CPU architectues.
As suggested by kkrambo you may also try BigDigits
library with NO_ALLOCS
option, that is available since version 2.2:
Added the NO_ALLOCS option to compile the "mp" library without using
any memory allocation.