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

Comparing ray/src/common/urand.c (file contents):
Revision 2.3 by gregl, Mon Dec 1 09:55:00 1997 UTC vs.
Revision 2.4 by gregl, Mon Jan 5 16:47:37 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Silicon Graphics, Inc. */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ SGI";
# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ SGI";
12  
13   #define  NULL           0
14  
15 + #define  MAXORDER       (8*sizeof(unsigned short))
16 +
17   extern char  *malloc();
18  
19 < short  *urperm = NULL;  /* urand() permutation */
19 > unsigned short  *urperm = NULL; /* urand() permutation */
20   int  urmask;            /* bits used in permutation */
21  
22  
# Line 30 | Line 32 | int  size;
32          size--;
33          for (i = 1; size >>= 1; i++)
34                  ;
35 <        order = i;
35 >        order = i>MAXORDER ? MAXORDER : i;
36          urmask = (1<<i) - 1;
37 <        urperm = (short *)malloc((urmask+1)*sizeof(short));
37 >        urperm = (unsigned short *)malloc((urmask+1)*sizeof(unsigned short));
38          if (urperm == NULL) {
39                  eputs("out of memory in initurand\n");
40                  quit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines