I've worked through gmp.h and noted some interesting/undocumented
macros and a couple of other things. The notes are short enough that
they can be given here (most of the interesting macros are in gmp-
impl.h not gmp.h):

Some compilers/languages with hacks in gmp.h:
====================================
- GNUC
- DEC C
- SCO OpenUNIX 8 cc
- __cplusplus

Useful/undocumented macros in gmp.h:
====================================
__GMPN_ABS(x) - absolute value
__GMPN_MAX(h, i) - max of h and i

__GMPN_UINT_MAX - (int) ~0
__GMPN_ULONG_MAX - (unsigned long) ~0
__GMPN_USHRT_MAX - unsigned short) ~0

__GMPN_LIKELY(cond) - branch likely hint
__GMPN_UNLIKELY(cond) - branch unlikely hint
  - e.g. if UNLIKELY(c >= 0L)....

Note: the __GMPN_ macros are redefined with nicer names in gmp-impl.h

mp_bits_per_limb - number of bits per limb
gmp_version - GMP version number i.j or i.j.k as a null terminated
string
gmp_errno - integer corresponding to a GMP error condition:
  0 none
  1 unsupported argument
  2 division by zero
  4 sqrt of negative
  8 invalid argument

Undocumented mpn functions prototyped in gmp.h:
===============================================
mp_limb_t mpn_preinv_mod_1(mp_srcptr sp, mp_size_t sn, mp_limb_t x,
mp_limb_t xinv) -
  compute {sp, sn} mod x given a precomputed inverse xinv of x

-----------------------------------------------------------------------------------------------------------------------------

I've made a direcory inside doc called devel in which I will stick
such documentation for now. I plan to go through gmp-impl.h and make
notes about what is in there next.

I'll also try and add some kind of top down description of how GMP
gets built and something about what seems to be the current rationale
behind all these aliases for the same macros/functions. That's not
going to be so easy, but I'm getting a clearer picture as I read more
files.

Bill.




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to