summaryrefslogtreecommitdiff
path: root/fourier.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-15 02:30:14 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-15 02:30:14 +0000
commit5bded43a8b43a0da5abf953c37ffd6fcd77f4443 (patch)
treeeadd5d60b23c54fcf2a9f546743682a708bbd28e /fourier.c
parent332747f6df0cd2af6535d81ccde00ade374563fa (diff)
Clean IDEA struct. Replace with local static variables
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@49 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
Diffstat (limited to 'fourier.c')
-rw-r--r--fourier.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fourier.c b/fourier.c
index 81ec5b2..d45f784 100644
--- a/fourier.c
+++ b/fourier.c
@@ -44,19 +44,19 @@ DoFourier(void)
clock_t total_time = 0;
int iterations = 0;
static int is_adjusted = FALSE;
+ static int array_size = 100;
if (is_adjusted == FALSE) {
is_adjusted = TRUE;
- locfourierstruct->arraysize = 100L; /* Start at 100 elements */
while (1) {
- abase = realloc(abase, locfourierstruct->arraysize * sizeof(double));
+ abase = realloc(abase, array_size * sizeof(double));
if (!abase) {
fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context);
exit(1);
}
- bbase = realloc(bbase, locfourierstruct->arraysize * sizeof(double));
+ bbase = realloc(bbase, array_size * sizeof(double));
if (!bbase) {
fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context);
free(abase);
@@ -69,27 +69,27 @@ DoFourier(void)
** larger arrays and try again.
*/
- if (DoFPUTransIteration(abase,bbase, locfourierstruct->arraysize) > MINIMUM_TICKS) {
+ if (DoFPUTransIteration(abase,bbase, array_size) > MINIMUM_TICKS) {
break;
}
/*
** Make bigger arrays and try again.
*/
- locfourierstruct->arraysize += 50L;
+ array_size += 50;
}
} else {
/*
** Don't need self-adjustment. Just allocate the
** arrays, and go.
*/
- abase = malloc(locfourierstruct->arraysize * sizeof(double));
+ abase = malloc(array_size * sizeof(double));
if (!abase) {
fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context);
exit(1);
}
- bbase = malloc(locfourierstruct->arraysize * sizeof(double));
+ bbase = malloc(array_size * sizeof(double));
if (!bbase) {
fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context);
free(abase);
@@ -98,8 +98,8 @@ DoFourier(void)
}
do {
- total_time += DoFPUTransIteration(abase,bbase,locfourierstruct->arraysize);
- iterations += locfourierstruct->arraysize * 2 - 1;
+ total_time += DoFPUTransIteration(abase,bbase,array_size);
+ iterations += array_size * 2 - 1;
} while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC);
free(abase);