diff options
-rw-r--r-- | fourier.c | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -49,12 +49,14 @@ DoFourier(void) clock_t total_time = 0; int iterations = 0; static bool is_adjusted = false; - static int array_size = 100; + static int array_size = 50; if (is_adjusted == false) { is_adjusted = true; - while (1) { + do { + array_size += 50; + abase = realloc(abase, array_size * sizeof(double)); if (!abase) { fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); @@ -73,16 +75,7 @@ DoFourier(void) ** less than or equal to the permitted minimum, re-allocate ** larger arrays and try again. */ - - if (DoFPUTransIteration(abase,bbase, array_size) > MINIMUM_TICKS) { - break; - } - - /* - ** Make bigger arrays and try again. - */ - array_size += 50; - } + } while (DoFPUTransIteration(abase,bbase, array_size) <= MINIMUM_TICKS); } else { /* ** Don't need self-adjustment. Just allocate the |