ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/source.c
(Generate patch)

Comparing ray/src/rt/source.c (file contents):
Revision 1.12 by greg, Tue Jun 13 10:57:52 1989 UTC vs.
Revision 1.13 by greg, Mon Jun 19 11:44:58 1989 UTC

# Line 344 | Line 344 | char  *p;                      /* data for f */
344          }
345                                                  /* sort contributions */
346          qsort(cntord, nsources, sizeof(CNTPTR), cntcmp);
347 <                                                /* find last */
348 <        sn = 0; ncnts = nsources;
349 <        while (sn < ncnts-1) {
350 <                register int  m;
351 <                m = (sn + ncnts) >> 1;
352 <                if (cntord[m].brt > 0.0)
353 <                        sn = m;
354 <                else
355 <                        ncnts = m;
356 <        }
347 >        {                                       /* find last */
348 >                register int  l, m;
349 >
350 >                sn = 0; ncnts = l = nsources;
351 >                while ((m = (sn + ncnts) >> 1) != l) {
352 >                        if (cntord[m].brt > 0.0)
353 >                                sn = m;
354 >                        else
355 >                                ncnts = m;
356 >                        l = m;
357 >                }
358 >        }
359                                                  /* accumulate tail */
360          for (sn = ncnts-1; sn > 0; sn--)
361                  cntord[sn-1].brt += cntord[sn].brt;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines