chiark
/
gitweb
/
~ianmdlvl
/
matchsticks-search.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ebbb693
)
break out maxhamweight_ok (no functional change)
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 19:41:53 +0000
(19:41 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 19:41:53 +0000
(19:41 +0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index 8d006d9ca40e6cb35ea4428590ba4cc3d9b1e03e..8aaebad359679275a74ebd524460c6f67d0356f6 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 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) {
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 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;
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++) {
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);
continue;
iterate_recurse(0, 1);