diff options
author | Bruno Haible <bruno@clisp.org> | 2018-09-08 15:56:21 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-09-08 15:56:21 +0200 |
commit | 947854520be07af4256f7b71956aeb83dcbb149c (patch) | |
tree | 6e2880942206ab584dd03e905dff6f2aaff4db3e | |
parent | a720310c28ef0f491a81f69dfa83a538fdbc1d79 (diff) | |
download | gperf-947854520be07af4256f7b71956aeb83dcbb149c.tar.gz |
Really prefer more efficient hash functions over less efficient ones.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/search.cc | 4 |
2 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,14 @@ 2018-09-08 Bruno Haible <bruno@clisp.org> + Really prefer more efficient hash functions over less efficient ones. + Reported by Frank Wojcik <frankw@touristinresidence.com> in + <https://savannah.gnu.org/patch/?9561>. + * 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 <bruno@clisp.org> + Correct width of columns when outputting the asso_values array. Patch by Frank Wojcik <frankw@touristinresidence.com>. * src/output.cc (Output::output_hash_function): Increase the 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; |