[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects

Akarsh Simha akarshsimha at gmail.com
Tue Nov 3 09:34:22 CET 2009


On Mon, Nov 02, 2009 at 04:44:05PM -0500, Médéric Boquien wrote:
> On Monday 02 November 2009 16:11:50 Alexey Khudyakov wrote:
> > @@ -294,8 +322,13 @@
> >              starColor.getHsvF(&h, &s, &v, &a);
> >              for (int i = 0; i < 8; i++ ) {
> >                  for (int j = 0; j < 8; j++ ) {
> > -                    qreal dist = sqrt( pow( i-7., 2. ) + pow( j-7., 2. )
> > )/7.; -                    starColor.setHsvF(h, qMin( qreal(1), dist <
> > (10-starColorIntensity)/10.?0:dist ), v, qMax( qreal(0), dist <
> > (10-starColorIntensity)/20.?1:1-dist ) );
> > +                    qreal x = i - 7;
> > +                    qreal y = j - 7;
> 
> If i am not mistaken, x=i-7 could be moved one level up. Also, i have a naive 
> question, won't it recreate the variables each time the inner loop is 
> restarted? Wouldn't it be more efficient to create them outside the loops?

I think that most compilers will take care to optimize that.

Regards
Akarsh


More information about the Kstars-devel mailing list