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

Comparing ray/src/common/objset.c (file contents):
Revision 1.2 by greg, Thu Sep 6 23:32:41 1990 UTC vs.
Revision 1.6 by greg, Fri Dec 14 10:06:33 1990 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19   #include  "otypes.h"
20  
21 < #define  OSTSIZ         3037            /* object table size (a prime!) */
21 > #ifndef  OSTSIZ
22 > #define  OSTSIZ         12329           /* object table size (a prime!) */
23 > #endif
24  
25   static OBJECT  *ostable[OSTSIZ];        /* the object set table */
26  
# Line 44 | Line 46 | OBJECT  obj;
46   {
47          register int  i;
48  
49 <        for (i = (*os++)--; i > 0 && *os < obj; i--, os++)
50 <                ;
49 >        i = (*os)--;
50 >        os++;
51 >        while (i > 0 && *os < obj) {
52 >                i--;
53 >                os++;
54 >        }
55          while (--i > 0) {
56                  os[0] = os[1];
57                  os++;
# Line 182 | Line 188 | nonsurfinset(orig, nobjs)              /* check sets for non-surfa
188   int  orig, nobjs;
189   {
190          int  n;
185        OBJECT  *nonset;
191          register OBJECT  *os;
192          register OBJECT  i;
193 <                                                /* count non-surfaces */
189 <        n = 0;
190 <        for (i = orig; i < orig+nobjs; i++)
191 <                if (!issurface(objptr(i)->otype))
192 <                        n++;
193 <        if (n <= 0)
194 <                return(0);
195 <                                                /* allocate set */
196 <        if ((nonset = (OBJECT *)malloc((n+1)*sizeof(OBJECT))) == NULL)
197 <                return(0);              /* give up if we haven't enough mem */
198 <                                                /* fill set */
199 <        os = nonset;
200 <        *os = n;
201 <        for (i = orig; i < orig+nobjs; i++)
202 <                if (!issurface(objptr(i)->otype))
203 <                        *++os = i;
204 <                                                /* now check all sets */
193 >
194          for (n = 0; n < OSTSIZ; n++) {
195                  if ((os = ostable[n]) == NULL)
196                          continue;
197                  while ((i = *os++) > 0)
198                          while (i--) {
199 <                                if (*os >= nonset[1]
200 <                                                && *os <= nonset[nonset[0]]
201 <                                                && inset(nonset, *os))
213 <                                        goto done;
199 >                                if (*os >= orig && *os < orig+nobjs &&
200 >                                                !issurface(objptr(*os)->otype))
201 >                                        return(1);
202                                  os++;
203                          }
204          }
205 < done:
218 <        free((char *)nonset);
219 <        return(n < OSTSIZ);
205 >        return(0);
206   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines