diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-04-14 01:07:52 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-04-14 01:07:52 -0700 |
commit | 02a48f17aa3a8080563593ab849bd2458a0c3113 (patch) | |
tree | e683d520d73e96fcb7a6827026d23537c0817788 /perllib | |
parent | 300d4816804c8ceb4a4601a49ec3ec479c1951b5 (diff) | |
download | nasm-02a48f17aa3a8080563593ab849bd2458a0c3113.tar.gz nasm-02a48f17aa3a8080563593ab849bd2458a0c3113.tar.bz2 nasm-02a48f17aa3a8080563593ab849bd2458a0c3113.zip |
Imported Upstream version 2.10.07upstream/2.10.07upstream-2.10.07
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/phash.ph | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/perllib/phash.ph b/perllib/phash.ph index 6b31f0a..8142c4e 100644 --- a/perllib/phash.ph +++ b/perllib/phash.ph @@ -146,7 +146,7 @@ sub gen_perfect_hash($) { # Minimal power of 2 value for N with enough wiggle room. # The scaling constant must be larger than 0.5 in order for the # algorithm to ever terminate. - my $room = scalar(@keys)*0.8; + my $room = int(scalar(@keys)*0.8); $n = 1; while ($n < $room) { $n <<= 1; @@ -161,7 +161,7 @@ sub gen_perfect_hash($) { for ($j = 0; $j < $maxj; $j++) { $sv = $random_sv_vectors[$j]; @hashinfo = gen_hash_n($n, $sv, $href, $run++); - return @hashinfo if (defined(@hashinfo)); + return @hashinfo if (@hashinfo); } $n <<= 1; } @@ -170,32 +170,6 @@ sub gen_perfect_hash($) { } # -# Read input file -# -sub read_input() { - my $key,$val; - my %out; - my $x = 0; - - while (defined($l = <STDIN>)) { - chomp $l; - $l =~ s/\s*(\#.*|)$//; - - next if ($l eq ''); - - if ($l =~ /^([^=]+)\=([^=]+)$/) { - $out{$1} = $2; - $x = $2; - } else { - $out{$l} = $x; - } - $x++; - } - - return %out; -} - -# # Verify that the hash table is actually correct... # sub verify_hash_table($$) |