--- ray/src/common/objset.c 1990/09/06 23:32:41 1.2 +++ ray/src/common/objset.c 1992/07/13 14:23:21 2.3 @@ -18,7 +18,13 @@ static char SCCSid[] = "$SunId$ LBL"; #include "otypes.h" -#define OSTSIZ 3037 /* object table size (a prime!) */ +#ifndef OSTSIZ +#ifdef BIGMEM +#define OSTSIZ 56437 /* object table size (a prime!) */ +#else +#define OSTSIZ 12329 /* object table size (a prime!) */ +#endif +#endif static OBJECT *ostable[OSTSIZ]; /* the object set table */ @@ -44,8 +50,12 @@ OBJECT obj; { register int i; - for (i = (*os++)--; i > 0 && *os < obj; i--, os++) - ; + i = (*os)--; + os++; + while (i > 0 && *os < obj) { + i--; + os++; + } while (--i > 0) { os[0] = os[1]; os++; @@ -182,39 +192,18 @@ nonsurfinset(orig, nobjs) /* check sets for non-surfa int orig, nobjs; { int n; - OBJECT *nonset; register OBJECT *os; - register OBJECT i; - /* count non-surfaces */ - n = 0; - for (i = orig; i < orig+nobjs; i++) - if (!issurface(objptr(i)->otype)) - n++; - if (n <= 0) - return(0); - /* allocate set */ - if ((nonset = (OBJECT *)malloc((n+1)*sizeof(OBJECT))) == NULL) - return(0); /* give up if we haven't enough mem */ - /* fill set */ - os = nonset; - *os = n; - for (i = orig; i < orig+nobjs; i++) - if (!issurface(objptr(i)->otype)) - *++os = i; - /* now check all sets */ + register OBJECT i, s; + for (n = 0; n < OSTSIZ; n++) { if ((os = ostable[n]) == NULL) continue; while ((i = *os++) > 0) - while (i--) { - if (*os >= nonset[1] - && *os <= nonset[nonset[0]] - && inset(nonset, *os)) - goto done; - os++; - } + do + if ((s = *os++) >= orig && s < orig+nobjs && + ismodifier(objptr(s)->otype)) + return(1); + while (--i); } -done: - free((char *)nonset); - return(n < OSTSIZ); + return(0); }