mpz_{eq,lt,gt}_{ui,si}_p macros?

Marc Glisse marc.glisse at inria.fr
Mon Feb 11 00:24:12 CET 2013


On Sun, 10 Feb 2013, bodrato at mail.dm.unipi.it wrote:

> I do not know if current gcc can optimise a loop like:
> for (int i = 3; (i < 1 << 30) && mpz_gt_ui_p (z, i); i <<= 1) ;
> but we give it the chance to.

You should use i*=2 instead of i<<=1 to maximize optimization 
opportunities. And then gcc does optimize this.

-- 
Marc Glisse


More information about the gmp-devel mailing list