diff options
-rw-r--r-- | stringsort.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/stringsort.c b/stringsort.c index 5f47528..ed8c913 100644 --- a/stringsort.c +++ b/stringsort.c @@ -56,7 +56,7 @@ DoStringSort(void) unsigned char* array = NULL; clock_t total_time = 0; int iterations = 0; - static int num_arrays = 1; + static int num_arrays = 0; static bool is_adjusted = false; if (is_adjusted == false) { @@ -64,7 +64,8 @@ DoStringSort(void) /* ** Initialize the number of arrays. */ - while (1) { + do { + ++num_arrays; /* ** Allocate space for array. We'll add an extra 100 ** bytes to protect memory as strings move around @@ -82,12 +83,7 @@ DoStringSort(void) ** minimum, then de-allocate the array, reallocate a ** an additional array, and try again. */ - if (DoStringSortIteration(array, num_arrays) > MINIMUM_TICKS) { - break; - } - - ++num_arrays; - } + } while (DoStringSortIteration(array, num_arrays) <= MINIMUM_TICKS); } else { /* ** We don't have to perform self adjustment code. |