From 947854520be07af4256f7b71956aeb83dcbb149c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 8 Sep 2018 15:56:21 +0200 Subject: Really prefer more efficient hash functions over less efficient ones. --- ChangeLog | 9 +++++++++ src/search.cc | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2cccbc7..d1e00a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-09-08 Bruno Haible + + Really prefer more efficient hash functions over less efficient ones. + Reported by Frank Wojcik in + . + * src/search.cc (Search::find_positions): In step 4, make sure a less + efficient hash function does not replace a more efficient one. Also, + include i3 = -1 among the search. + 2018-09-08 Bruno Haible Correct width of columns when outputting the asso_values array. diff --git a/src/search.cc b/src/search.cc index 48dc722..959580f 100644 --- a/src/search.cc +++ b/src/search.cc @@ -419,7 +419,7 @@ Search::find_positions () for (int i2 = imax; i2 >= -1; i2--) if (current.contains (i2) && !mandatory.contains (i2) && i2 != i1) { - for (int i3 = imax; i3 >= 0; i3--) + for (int i3 = imax; i3 >= -1; i3--) if (!current.contains (i3)) { Positions tryal = current; @@ -435,7 +435,7 @@ Search::find_positions () function. */ if (try_duplicates_count < best_duplicates_count || (try_duplicates_count == best_duplicates_count - && (i1 == -1 || i2 == -1 || i3 >= 0))) + && (i1 == -1 || i2 == -1) && i3 >= 0)) { best = tryal; best_duplicates_count = try_duplicates_count; -- cgit v1.2.1