From 195ad16c62e680b4bb3835991a7b7bd6ddbf7afc Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@2ndquadrant.com>
Date: Tue, 12 May 2020 17:45:49 +0800
Subject: [PATCH v1 1/3] Tweak the set of candidate multipliers for generating
 perfect hash functions

The previous set of multipliers were inadequate for large sets of short
keys. A future commit will have that as a use case, so increase the
maximum size of multipliers attempted.

Also make sure all multipliers compile to shift-and-add instructions
on most platforms. On x86-64 this was confirmed as far back as gcc 4.1
and clang 3.8.
---
 src/tools/PerfectHash.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tools/PerfectHash.pm b/src/tools/PerfectHash.pm
index 74fb1f2ef6..d6841589a3 100644
--- a/src/tools/PerfectHash.pm
+++ b/src/tools/PerfectHash.pm
@@ -81,13 +81,13 @@ sub generate_hash_function
 	# to calculate via shift-and-add, so don't change them without care.
 	# (Commonly, random seeds are tried, but we want reproducible results
 	# from this program so we don't do that.)
-	my $hash_mult1 = 31;
+	my $hash_mult1 = 257;
 	my $hash_mult2;
 	my $hash_seed1;
 	my $hash_seed2;
 	my @subresult;
   FIND_PARAMS:
-	foreach (127, 257, 521, 1033, 2053)
+	foreach (17, 31, 127, 8191)
 	{
 		$hash_mult2 = $_;    # "foreach $hash_mult2" doesn't work
 		for ($hash_seed1 = 0; $hash_seed1 < 10; $hash_seed1++)
-- 
2.22.0

