GMP and 64-bit systems

Torbjorn Granlund tg at swox.com
Sun Jun 1 16:55:38 CEST 2008


Roberto Bagnara <bagnara at cs.unipr.it> writes:

  1) "long long" is the future (it is in C99, it will be in the C++
     standard, most common compilers support it, ...);
  2) the GNU system C compiler supports "long long", so supporting
     "long long" in GMP gives some competitive advantage to GNU;
  3) in order to support old, non-GNU compilers we can #ifdef out
     the "long long" portion of gmp.h and gmpxx.h.
  
  I realize this breaks the rule "we want there to be one GMP ABI",
  a rule I only partly understand.  The ABI should not be changed
  every other day, but I don't think this should impede progress
  forever.  Old (obsoletizing) systems would simply use a subset of the
  functionalities of newer GMPs;  new systems would take full advantage
  of modern language standards and compiler technology.
  All the best,
  
I didn't mean that "the GMP ABI" should be an unchanging thing.  When
I said we want there to be one GMP ABI, I mean that (say) GMP 4.3
should provide one ABI over all platforms and compilers, GMP 4.4 might
provide another single ABI.  Otherwise it would be difficult to write
software using GMP.

I suppose one could have gmp.h define various paramaters,
"GMP_HAS_mpz_add_ull", that user code need to test before using
certain routines.  But I feel that it might cost more than it is
worth.

I different approach, would be to allow two "long" parameters, with
the low and high part of some parameter, respectively.

Note that "long long" does not typically provide any speed improvement
on any relevant platforms.  On 32-bit systems, it is two words, of
course.  On 64-bit machines, it is practically always simply a long.

-- 
Torbjörn


More information about the gmp-discuss mailing list