diff options
Diffstat (limited to 'fourier.c')
-rw-r--r-- | fourier.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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); |