chiark / gitweb /
break out maxhamweight_ok (no functional change)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 19:41:53 +0000 (19:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 19:41:53 +0000 (19:41 +0000)
main.c

diff --git a/main.c b/main.c
index 8d006d9..8aaebad 100644 (file)
--- a/main.c
+++ b/main.c
@@ -99,6 +99,7 @@ static unsigned printcounter;
 static void iterate(void);
 static void iterate_recurse(int i, AdjWord min);
 static bool preconsider_ok(int nwords, bool doprint);
+static bool maxhamweight_ok(void);
 static void optimise(bool doprint);
 
 static void progress_eol(void) {
@@ -337,6 +338,11 @@ static int count_set_adj_bits(AdjWord w) {
 
 static int totalfrags;
 
+static bool maxhamweight_ok(void) {
+  double maxminsize = (double)m / maxhamweight;
+  return maxminsize > best;
+}
+
 static bool preconsider_ok(int nwords, bool doprint) {
   int i;
 
@@ -586,8 +592,7 @@ static void iterate_recurse(int i, AdjWord min) {
 
 static void iterate(void) {
   for (maxhamweight=1; maxhamweight<=m; maxhamweight++) {
-    double maxminsize = (double)m / maxhamweight;
-    if (maxminsize <= best)
+    if (!maxhamweight_ok())
       continue;
 
     iterate_recurse(0, 1);