Micro-GMP

Vincent Lefevre vincent at vinc17.net
Mon Dec 10 10:47:38 UTC 2018


On 2018-12-10 10:46:26 +0100, paul zimmermann wrote:
>        Dear Marco,
> 
> > mpz_cmpabs_ui (const mpz_t u, unsigned long v)
> > {
> >   int ulongsize = GMP_ULONG_BITS / GMP_LIMB_BITS;
> >   mp_limb_t ulongrem = 0;
> >   mp_size_t un = GMP_ABS (u->_mp_size);
> > 
> >   if (GMP_ULONG_BITS % GMP_LIMB_BITS != 0)
> >     ulongrem = (ULONG_MAX >> GMP_LIMB_BITS * ulongsize) + 1;
> 
> is GMP_ULONG_BITS % GMP_LIMB_BITS != 0 allowed in GMP and/or asl.h?

This will probably occur if mp_limb_t is an unsigned long long.

This may also occur if mp_limb_t is an unsigned int.
gmp-h.in still mentions 48-bit int on Cray (but I don't know the
size of a long).

All this assuming no padding bits (I doubt they are supported),
which would make things even more complex.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list