summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-14 16:25:23 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-14 16:25:23 +0000
commitf53310f5bd1e509c59b2f8047e897ae110c1066a (patch)
treef26fda644d1cf50b9ff14e8a3fe99cb33f0cad7d
parent85ee0ac91540be34e55f05c0b03757d6a5e3da59 (diff)
Remove #defines, replace with enum
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@36 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r--cleanbench.c68
-rw-r--r--cleanbench.h35
2 files changed, 52 insertions, 51 deletions
diff --git a/cleanbench.c b/cleanbench.c
index 7b8e118..cf627e7 100644
--- a/cleanbench.c
+++ b/cleanbench.c
@@ -10,9 +10,6 @@
** ver 2.0 **
** Rick Grehan, BYTE Magazine **
********************************************
-** NOTE: These benchmarks do NOT check for the presence
-** of an FPU. You have to find that out manually.
-**
** REVISION HISTORY FOR BENCHMARKS
** 9/94 -- First beta. --RG
** 12/94 -- Bug discovered in some of the integer routines
@@ -90,8 +87,9 @@ fpindex=(double)1.0;
** We presume all tests will be run unless told
** otherwise
*/
-for(i=0;i<NUMTESTS;i++)
- tests_to_do[i]=1;
+for (i = 0; i < NUMTESTS; i++) {
+ tests_to_do[i] = TRUE;
+}
/*
** Initialize test data structures to default
@@ -411,7 +409,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DONUM: /* DONUMSORT */
- tests_to_do[TF_NUMSORT]=getflag(eptr);
+ tests_to_do[NUMSORT]=getflag(eptr);
break;
case PF_NUMNUMA: /* NUMNUMARRAYS */
@@ -431,7 +429,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOSTR: /* DOSTRINGSORT */
- tests_to_do[TF_SSORT]=getflag(eptr);
+ tests_to_do[STRINGSORT]=getflag(eptr);
break;
case PF_STRASIZE: /* STRARRAYSIZE */
@@ -451,7 +449,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOBITF: /* DOBITFIELD */
- tests_to_do[TF_BITOP]=getflag(eptr);
+ tests_to_do[BITFIELD]=getflag(eptr);
break;
case PF_NUMBITOPS: /* NUMBITOPS */
@@ -471,7 +469,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOEMF: /* DOEMF */
- tests_to_do[TF_FPEMU]=getflag(eptr);
+ tests_to_do[FPEMULATION]=getflag(eptr);
break;
case PF_EMFASIZE: /* EMFARRAYSIZE */
@@ -490,7 +488,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOFOUR: /* DOFOUR */
- tests_to_do[TF_FFPU]=getflag(eptr);
+ tests_to_do[FOURIER]=getflag(eptr);
break;
case PF_FOURASIZE: /* FOURASIZE */
@@ -505,7 +503,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOASSIGN: /* DOASSIGN */
- tests_to_do[TF_ASSIGN]=getflag(eptr);
+ tests_to_do[ASSIGNMENT]=getflag(eptr);
break;
case PF_AARRAYS: /* ASSIGNARRAYS */
@@ -519,7 +517,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOIDEA: /* DOIDEA */
- tests_to_do[TF_IDEA]=getflag(eptr);
+ tests_to_do[IDEA]=getflag(eptr);
break;
case PF_IDEAASIZE: /* IDEAARRAYSIZE */
@@ -538,7 +536,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOHUFF: /* DOHUFF */
- tests_to_do[TF_HUFF]=getflag(eptr);
+ tests_to_do[HUFFMAN]=getflag(eptr);
break;
case PF_HUFFASIZE: /* HUFFARRAYSIZE */
@@ -558,7 +556,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DONNET: /* DONNET */
- tests_to_do[TF_NNET]=getflag(eptr);
+ tests_to_do[NEURAL]=getflag(eptr);
break;
case PF_NNETLOOPS: /* NNETLOOPS */
@@ -573,7 +571,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL)
break;
case PF_DOLU: /* DOLU */
- tests_to_do[TF_LU]=getflag(eptr);
+ tests_to_do[LINEAR]=getflag(eptr);
break;
case PF_LUNARRAYS: /* LUNUMARRAYS */
@@ -799,25 +797,25 @@ static double getscore(int fid) {
** doing the proper coercion.
*/
switch(fid) {
- case TF_NUMSORT:
+ case NUMSORT:
return(global_numsortstruct.sortspersec);
- case TF_SSORT:
+ case STRINGSORT:
return(global_strsortstruct.sortspersec);
- case TF_BITOP:
+ case BITFIELD:
return(global_bitopstruct.bitopspersec);
- case TF_FPEMU:
+ case FPEMULATION:
return(global_emfloatstruct.emflops);
- case TF_FFPU:
+ case FOURIER:
return(global_fourierstruct.fflops);
- case TF_ASSIGN:
+ case ASSIGNMENT:
return(global_assignstruct.iterspersec);
- case TF_IDEA:
+ case IDEA:
return(global_ideastruct.iterspersec);
- case TF_HUFF:
+ case HUFFMAN:
return(global_huffstruct.iterspersec);
- case TF_NNET:
+ case NEURAL:
return(global_nnetstruct.iterspersec);
- case TF_LU:
+ case LINEAR:
return(global_lustruct.iterspersec);
}
return 0.0;
@@ -831,40 +829,40 @@ static double getscore(int fid) {
*/
static void show_stats (int bid) {
switch(bid) {
- case TF_NUMSORT: /* Numeric sort */
+ case NUMSORT: /* Numeric sort */
printf(" Number of arrays: %d\n", global_numsortstruct.numarrays);
printf(" Array size: %ld\n", global_numsortstruct.arraysize);
break;
- case TF_SSORT: /* String sort */
+ case STRINGSORT: /* String sort */
printf(" Number of arrays: %d\n", global_strsortstruct.numarrays);
printf(" Array size: %ld\n", global_strsortstruct.arraysize);
break;
- case TF_BITOP: /* Bitmap operation */
+ case BITFIELD: /* Bitmap operation */
printf(" Operations array size: %ld\n", global_bitopstruct.bitoparraysize);
printf(" Bitfield array size: %ld\n", global_bitopstruct.bitfieldarraysize);
break;
- case TF_FPEMU: /* Floating-point emulation */
+ case FPEMULATION: /* Floating-point emulation */
printf(" Number of loops: %lu\n", global_emfloatstruct.loops);
printf(" Array size: %lu\n", global_emfloatstruct.arraysize);
break;
- case TF_FFPU: /* Fourier test */
+ case FOURIER: /* Fourier test */
printf(" Number of coefficients: %lu\n", global_fourierstruct.arraysize);
break;
- case TF_ASSIGN:
+ case ASSIGNMENT:
printf(" Number of arrays: %lu\n", global_assignstruct.numarrays);
break;
- case TF_IDEA:
+ case IDEA:
printf(" Array size: %lu\n", global_ideastruct.arraysize);
printf(" Number of loops: %lu\n", global_ideastruct.loops);
break;
- case TF_HUFF:
+ case HUFFMAN:
printf(" Array size: %lu\n", global_huffstruct.arraysize);
printf(" Number of loops: %lu\n", global_huffstruct.loops);
break;
- case TF_NNET:
+ case NEURAL:
printf(" Number of loops: %lu\n", global_nnetstruct.loops);
break;
- case TF_LU:
+ case LINEAR:
printf(" Number of arrays: %lu\n", global_lustruct.numarrays);
break;
}
diff --git a/cleanbench.h b/cleanbench.h
index 278de90..3efc5dd 100644
--- a/cleanbench.h
+++ b/cleanbench.h
@@ -80,20 +80,29 @@ char *compilerversion="Have a nice day";
#define MAXPARAM 41
/* Tests-to-do flags...must coincide with test. */
-#define TF_NUMSORT 0
-#define TF_SSORT 1
-#define TF_BITOP 2
-#define TF_FPEMU 3
-#define TF_FFPU 4
-#define TF_ASSIGN 5
-#define TF_IDEA 6
-#define TF_HUFF 7
-#define TF_NNET 8
-#define TF_LU 9
+enum {
+ NUMSORT,
+ STRINGSORT,
+ BITFIELD,
+ FPEMULATION,
+ FOURIER,
+ ASSIGNMENT,
+ IDEA,
+ HUFFMAN,
+ NEURAL,
+ LINEAR
+} tests_t;
#define NUMTESTS 10
/*
+** Following array is a collection of flags indicating which
+** tests to perform.
+*/
+int tests_to_do[NUMTESTS];
+
+
+/*
** GLOBALS
*/
@@ -193,12 +202,6 @@ char *paramnames[]= {
"ALIGN" };
/*
-** Following array is a collection of flags indicating which
-** tests to perform.
-*/
-int tests_to_do[NUMTESTS];
-
-/*
** Buffer for holding output text.
*/
char buffer[BUF_SIZ];