Lucien Hayen l.hayen at
Mon Oct 17 18:03:31 CEST 2005

I am totally new to the GMP package. The software version is 4.1.4.
The manual I have is 4.1.2.

Question 1.
Can anyone tell me where to find a more up to date manual in PDF or
PS format, if there is one, and if there are any differences with
the manual I have.

Question 2.
Chapter 3, section 3.8 (page 19) mentions the variable
"mp_bits_per_limb" which happens to have the value 32.
Chapter 8, section 8.1 (page 62) mentions GMP_LIMB_BITS which also
(as expected) has the value 32 since sizeof(mp_limb_t) is 4.
What is the difference between the two ?

Question 3.
In gmp.h I found : #define GMP_LIMB_BITS  32 where I would have
expected something more like
	#define GMP_LIMB_BITS (CHAR_BIT * sizeof(mp_limb_t))
or for standard 8 bit bytes
	#define GMP_LIMB_BITS (8 * sizeof(mp_limb_t))
or better still
	#define GMP_LIMB_BITS (sizeof(mp_limb_t) << 3)
Is there a special reason for avoiding such definitions ?

Question 4.
mp_set_memory_functions() is a routine that obviously must be
called before any initialization routine, most probably in main().
The so chosen routines are thus known on that level.
However, lower level private routines cannot access these 
memory routines unless each and every such routine takes 
them as arguments for no other reason than to transmit the pointers
to a possibly lower level still that wants to use them (a burden 
for the programmer and a possible source of mistakes).
Is there no portable way to obtain pointers to the active memory
functions ?
There are possible workarounds, but at the price of using the
internals of mpz_t which is discouraged.

Many thanks for any help you can give me.

Lucien Haijen

More information about the gmp-discuss mailing list