Warnings in GMP.H, and potentially more serious problem

Kevin Ryde user42 at zip.com.au
Mon Jul 5 02:14:58 CEST 2004


<jfoug at cox.net> writes:
>
> return __gmp_l & (~((mp_limb_t) (__gmp_n != 0)));

Not quite, but ~x+1 I guess.

> I am not sure if the code you listed below: return (__gmp_n != 0 ?
> __gmp_l : 0); would cause conditional execution paths or not, but I
> image that it does.

When I tried it gcc was good about optimizing that form.

One thing I don't want to do is obscure the fact that it can (and
should) be a cmov, or predicated, on suitable chips.  But somewhat
surprisingly gcc seems smart enough to even recognise the neg+and can
be turned into a cmov.

-- 
All followups to gmp-bugs at swox.com please.


More information about the gmp-bugs mailing list