ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/p.c
Revision: 1.3
Committed: Wed Feb 19 16:47:41 2003 UTC (21 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -1 lines
Log Message:
Changed exit(0) to return(0) because that's just the way it should be.

File Contents

# User Rev Content
1 apian 1.1 #include <stdlib.h>
2     #include <stdio.h>
3     #include <malloc.h>
4    
5     main( int argc, char *argv[])
6     {
7     int s,mb,q,a;
8     unsigned char *mem,b;
9    
10     if( argc != 2 ) {
11     fprintf(stderr,"usage: p MB\n");
12     exit(1);
13     }
14     s= 1024*1024* (mb=atoi(argv[1]));
15     if (!(mem=malloc(s))) {
16     printf("failed\n");
17     exit(1);
18     }
19     for (;;) {
20     for (q=0;q<mb;++q) {
21     a=q*1024*1024+ 1+(int)(1024*1024.0*rand()/(RAND_MAX+1.0)) ;
22     b=255*rand()/(RAND_MAX+1.0);
23     mem[a] = b;
24     if( mem[a] != b )
25     fprintf(stderr,"hopla %x\n", a);
26     }
27     }
28    
29 greg 1.3 return(0);
30 apian 1.1
31     }