summaryrefslogtreecommitdiff
path: root/huffman.c
diff options
context:
space:
mode:
Diffstat (limited to 'huffman.c')
-rw-r--r--huffman.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/huffman.c b/huffman.c
index 57daa05..cc0c553 100644
--- a/huffman.c
+++ b/huffman.c
@@ -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 {