diff options
-rw-r--r-- | huffman.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -71,7 +71,7 @@ DoHuffman(void) clock_t total_time = 0; int iterations = 0; static bool is_adjusted = false; - static int loops = 100; + static int loops = 90; /* 90 since we want it to be 100 for the first iteration and add 10 before the first iteration */ /* ** Allocate memory for the plaintext and the compressed text. @@ -138,11 +138,9 @@ DoHuffman(void) ** # of loops and increasing the loop count until we ** get a number of loops that we can use. */ - for (; loops < LOOP_MAX; loops += 10) { - if (DoHuffIteration(plaintext, comparray, decomparray, loops, hufftree) > MINIMUM_TICKS) { - break; - } - } + do { + loops += 10; + } while ((DoHuffIteration(plaintext, comparray, decomparray, loops, hufftree) <= MINIMUM_TICKS) && (loops < LOOP_MAX)); } do { |