From 55078bbd4486cfec9d884fe4c9f79b258035b0b0 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 17 Nov 2008 02:57:39 +0000 Subject: Convert for-if-break construct into do while git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@74 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- huffman.c | 10 ++++------ 1 file 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 { -- cgit v1.2.3