summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-17 02:57:39 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-17 02:57:39 +0000
commit55078bbd4486cfec9d884fe4c9f79b258035b0b0 (patch)
tree63bb863a587e1826a5ce2996c9e31c255317c29a
parentc8d46965ec6caa2622a0f471b8a7542382ca2b62 (diff)
Convert for-if-break construct into do while
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@74 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-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 {