Vincent Lefevre vincent at vinc17.net
Wed Dec 12 13:16:16 UTC 2018

On 2018-12-11 09:21:39 +0100, Niels Möller wrote:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
> > Supporting very small sizes, and odd sizes might not be easy. And
> > currently Paul reported failures for 32-bit limbs on 64-bit machines...
> > asl.h is more interesting for GMP than for mini-.
> And if we can make asl.h work well in GMP, small limb sizes in mini-gmp
> (Micro-GMP) becomes less interesting, right?

I would say that for MPFR, a bit less interesting, but not
uninteresting, because mini-gmp does not provide the same API as GMP.
In short, bugs in mpfr-mini-gmp.c related to small limb sizes could
be detected only with Micro-GMP.

Alternatively, perhaps mini-gmp could be completed in order to avoid
mpfr-mini-gmp.c completely...

> > Do you mean I should have pushed the line with even more parentheses?
> >     assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
> I would have written it that way. I find C precendence rules for these
> operators (defined to be same as for visually similar operators) a bit
> odd and hard to remember.

I completely agree.

> But it's fine as is, if you think that's more readable, and
> gcc -Wall doesn't warn about it.

It would be strange if gcc -Wall did not warn on the odd precendence

     Warn if parentheses are omitted in certain contexts, such as when
     there is an assignment in a context where a truth value is
     expected, or when operators are nested whose precedence people
     often get confused about.
           This warning is enabled by -Wall.

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