home *** CD-ROM | disk | FTP | other *** search
-
- TRS Seive Benchmark
- C Compiler Analysis
- February 1985 COMPUTER LANGUAGE
-
-
- SIEVE listing used to test LC:
- /* sieve test program for CLM C-compiler comparisons
- Jim Kyle, 6 November 1984
- */
- #include stdio/csh
- #define size 8190
- char flags[8191];
- main()
- {
- int i,prime,k,count,iter;
- printf("Start\n");
- for (iter=1; iter <= 10; iter++) {
- count = 0;
- for (i=0; i <= size; i++)
- flags[i] = TRUE;
- for (i=0; i<= size; i++) {
- if (flags[i]) {
- prime = i + i + 3;
- for (k=i+prime; k <=size; k+=prime)
- flags[k] = FALSE;
- count++;
- }
- }
- }
- printf("\nFound %d; stop\n", count);
- }
- /* END OF PROGRAM */
-
-
-
- MYSORT listing used to test LC:
- /* mysort/ccc - integer sorting benchmark, LC */
- #include stdio/csh
- #define MAX 1000èint a[MAX], working, jump,i,j,tempo;
- main()
- { printf("Initializing array\n");
- for (i=0; i<MAX; ++i)
- a[i] = i;
- jump = MAX;
- printf("Beginning to sort\n");
- while (jump>0) {
- jump /= 2;
- do {
- working=FALSE;
- for (j=0; j<(MAX-jump); ++j) {
- i=j+jump;
- if (a[i] > a[j]) {
- working=TRUE;
- tempo=a[i];
- a[i]=a[j];
- a[j]=tempo;
- }
- }
- } while (working);
- }
- printf("Finished sorting\n");
- for (i=0; i<MAX; ++i)
- printf("%d ",a[i]);
- }