support larger int types

Torbjörn Granlund tg at
Fri Oct 14 18:45:22 UTC 2016

Victor Shoup <shoup at> writes:

  I agree that this would be a nice feature but that it is also 
  kind of a pain because of the unstable API.
Are uintmax_t and intmax_t also optional for C99 conformant compilers?

I don't think we'd improve things by trying to provide a full set of GMP
functions.  We now have 'long' as the smallest type accepted as input
operand.  That's fast on all but some 8-bit and 16-bit CPUs, so
providing GMP functions accepting a smaller type makes little sense.

IIRC, long is guaranteed to be at least 32 bits, so existing GMP
functions cover intS_t for S <= 32 by means of type promotion.

If we can trust uintmax_t/intmax_t to exist, then accepting those in
(some) GMP functions would be an improvement.

If we cannot trust that, we can do 'long long' instead for the C
interface functions.  Since these types are very new in C++11, we might
wait a bit before we add them there.

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list