From 5bded43a8b43a0da5abf953c37ffd6fcd77f4443 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 15 Nov 2008 02:30:14 +0000 Subject: Clean IDEA struct. Replace with local static variables git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@49 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- fourier.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'fourier.c') 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); -- cgit v1.2.3