--- ray/src/hd/clumpbeams.c 1998/11/10 18:05:41 3.2 +++ ray/src/hd/clumpbeams.c 2003/11/17 02:21:53 3.7 @@ -1,9 +1,6 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: clumpbeams.c,v 3.7 2003/11/17 02:21:53 greg Exp $"; #endif - /* * Bundle holodeck beams together into clumps. */ @@ -11,7 +8,7 @@ static char SCCSid[] = "$SunId$ SGI"; #include "holo.h" #define flgop(p,i,op) ((p)[(i)>>5] op (1L<<((i)&0x1f))) -#define isset(p,i) flgop(p,i,&) +#define issetfl(p,i) flgop(p,i,&) #define setfl(p,i) flgop(p,i,|=) #define clrfl(p,i) flgop(p,i,&=~) @@ -55,10 +52,10 @@ GCOORD *gc; register int i, j; for (i = 3; i--; ) { - copystruct(&gci0, gc); + gci0 = *gc; gcshifti(&gci0, 0, i-1, hp); for (j = 3; j--; ) { - copystruct(ng+(3*i+j), &gci0); + *(ng+(3*i+j)) = gci0; gcshifti(ng+(3*i+j), gci0.w==gc->w, j-1, hp); } } @@ -79,12 +76,12 @@ int b; bneighrem = 0; for (i = 9; i--; ) for (j = 9; j--; ) { - if (i == 4 & j == 4) /* don't copy starting beam */ + if ((i == 4) & (j == 4)) /* don't copy starting beam */ continue; if (wg0[i].w == wg1[j].w) continue; - copystruct(bgc, wg0+i); - copystruct(bgc+1, wg1+j); + *bgc = *(wg0+i); + *(bgc+1) = *(wg1+j); bneighlist[bneighrem++] = hdbindex(hp, bgc); #ifdef DEBUG if (bneighlist[bneighrem-1] <= 0) @@ -101,10 +98,10 @@ int maxcnt, maxsiz; int (*cf)(); { static short primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1}; - unsigned int4 *bflags; + uint32 *bflags; int *bqueue; int bqlen; - int4 bqtotal; + int32 bqtotal; int bc, bci, bqc, myprime; register int i; /* get clump size */ @@ -113,9 +110,9 @@ int (*cf)(); maxsiz /= sizeof(RAYVAL); /* allocate beam queue */ bqueue = (int *)malloc(maxcnt*sizeof(int)); - bflags = (unsigned int4 *)calloc((nbeams(hp)>>5)+1, - sizeof(unsigned int4)); - if (bqueue == NULL | bflags == NULL) + bflags = (uint32 *)calloc((nbeams(hp)>>5)+1, + sizeof(uint32)); + if ((bqueue == NULL) | (bflags == NULL)) error(SYSTEM, "out of memory in clumpbeams"); /* mark empty beams as done */ for (i = nbeams(hp); i > 0; i--) @@ -130,7 +127,7 @@ int (*cf)(); /* add each input beam and neighbors */ for (bc = bci = nbeams(hp); bc > 0; bc--, bci += bci>myprime ? -myprime : nbeams(hp)-myprime) { - if (isset(bflags, bci)) + if (issetfl(bflags, bci)) continue; bqueue[0] = bci; /* initialize queue */ bqlen = 1; @@ -141,7 +138,7 @@ int (*cf)(); /* add neighbors until full */ for (i = firstneigh(hp,bqueue[bqc]); i > 0; i = nextneigh()) { - if (isset(bflags, i)) /* done already? */ + if (issetfl(bflags, i)) /* done already? */ continue; bqueue[bqlen++] = i; /* add it */ bqtotal += bnrays(hp, i); @@ -156,6 +153,6 @@ int (*cf)(); (*cf)(hp, bqueue, bqlen); /* transfer clump */ } /* all done; clean up */ - free((char *)bqueue); - free((char *)bflags); + free((void *)bqueue); + free((void *)bflags); }