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 2.2 by greg, Thu Mar 12 11:41:18 1992 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 > #ifdef  BIGMEM
23 > #define  OSTSIZ         56437           /* object table size (a prime!) */
24 > #else
25 > #define  OSTSIZ         12329           /* object table size (a prime!) */
26 > #endif
27 > #endif
28  
29   static OBJECT  *ostable[OSTSIZ];        /* the object set table */
30  
# Line 44 | Line 50 | OBJECT  obj;
50   {
51          register int  i;
52  
53 <        for (i = (*os++)--; i > 0 && *os < obj; i--, os++)
54 <                ;
53 >        i = (*os)--;
54 >        os++;
55 >        while (i > 0 && *os < obj) {
56 >                i--;
57 >                os++;
58 >        }
59          while (--i > 0) {
60                  os[0] = os[1];
61                  os++;
# Line 182 | Line 192 | nonsurfinset(orig, nobjs)              /* check sets for non-surfa
192   int  orig, nobjs;
193   {
194          int  n;
185        OBJECT  *nonset;
195          register OBJECT  *os;
196 <        register OBJECT  i;
197 <                                                /* 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 */
196 >        register OBJECT  i, s;
197 >
198          for (n = 0; n < OSTSIZ; n++) {
199                  if ((os = ostable[n]) == NULL)
200                          continue;
201                  while ((i = *os++) > 0)
202                          while (i--) {
203 <                                if (*os >= nonset[1]
204 <                                                && *os <= nonset[nonset[0]]
205 <                                                && inset(nonset, *os))
206 <                                        goto done;
203 >                                s = *os;
204 >                                if (s >= orig && s < orig+nobjs &&
205 >                                                ismodifier(objptr(s)->otype))
206 >                                        return(1);
207                                  os++;
208                          }
209          }
210 < done:
218 <        free((char *)nonset);
219 <        return(n < OSTSIZ);
210 >        return(0);
211   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines