3 # Perfect Minimal Hash Generator written in Perl, which produces
19 @hashinfo = gen_perfect_hash
(\
%data);
21 if (!defined(@hashinfo)) {
22 die "$0: no hash found\n";
25 verify_hash_table
(\
%data, \
@hashinfo);
27 ($n, $sv, $f1, $f2, $g) = @hashinfo;
29 print "static int HASHNAME_fg1[$n] =\n";
31 for ($i = 0; $i < $n; $i++) {
32 print "\t", ${$g}[${$f1}[$i]], "\n";
36 print "static int HASHNAME_fg2[$n] =\n";
38 for ($i = 0; $i < $n; $i++) {
39 print "\t", ${$g}[${$f2}[$i]], "\n";
43 print "struct p_hash HASHNAME =\n";
47 print "\tHASHNAME_fg1,\n";
48 print "\tHASHNAME_fg2,\n";