------- Comment #3 from pinskia at gcc dot gnu dot org  2008-05-07 09:51 -------
Also you may as well manually unswitch the loops as they don't do anything
except some multiplication if that bool is true.  That is better to write the
code as:
           if (a_eq_e)
            return;
          e=p[m].e;
         
q=COLOUR8(e.r/(a.r+grayabsorb),e.g/(a.g+grayabsorb),e.b/(a.b+grayabsorb));
          float64 radsq = rfacr*rfacr;
          float64 prefac1 = -0.5/(r*r*sigma0*sigma0);
          float64 prefac2 = -0.5*bfak/p[m].ro;
            {
            for (int x=minx; x<maxx; ++x)
              {
              float64 xsq=(x-posx)*(x-posx);
              for (int y=miny; y<maxy; ++y)
                {
                float64 dsq = (y-posy)*(y-posy) + xsq;
                if (dsq<radsq)
                  {
                  lpic[x][y].r = q.r;
                  lpic[x][y].g = q.g;
                  }
                }
              }
            }

As you now have better code as the code is faster as you don't have to go
through those loops at all or even calculate the inner float64s.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168

Reply via email to