summaryrefslogtreecommitdiff
path: root/tokhash.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-08-31 18:10:23 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-08-31 18:10:23 +0000
commitb938e043ca175a0911598e7f439ed6e200ab6f13 (patch)
treebff13a9cb486a41980dd7a739b23bea2bb565127 /tokhash.pl
parent96a810256fbdc9d210ba6baba5a690ce37c4a136 (diff)
downloadnasm-b938e043ca175a0911598e7f439ed6e200ab6f13.tar.gz
nasm-b938e043ca175a0911598e7f439ed6e200ab6f13.tar.bz2
nasm-b938e043ca175a0911598e7f439ed6e200ab6f13.zip
phash: don't rely on the build platform Perl version of rand()
rand() in Perl can vary between platforms, so don't use it. Instead, remove a completely pointless level of indirection (it introduced a permutation which cancelled itself out) and provide a canned set of random numbers for the rest. This guarantees we will always use the same numbers.
Diffstat (limited to 'tokhash.pl')
-rwxr-xr-xtokhash.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/tokhash.pl b/tokhash.pl
index fb65c2f..37be7b1 100755
--- a/tokhash.pl
+++ b/tokhash.pl
@@ -119,7 +119,7 @@ if (!defined(@hashinfo)) {
# Paranoia...
verify_hash_table(\%tokens, \@hashinfo);
-($n, $sv, $f1, $f2, $g) = @hashinfo;
+($n, $sv, $g) = @hashinfo;
$sv2 = $sv+2;
die if ($n & ($n-1));
@@ -155,14 +155,14 @@ print "#define UNUSED 16383\n";
print " static const int16_t hash1[$n] = {\n";
for ($i = 0; $i < $n; $i++) {
- my $h = ${$g}[${$f1}[$i]];
+ my $h = ${$g}[$i*2+0];
print " ", defined($h) ? $h : 'UNUSED', ",\n";
}
print " };\n";
print " static const int16_t hash2[$n] = {\n";
for ($i = 0; $i < $n; $i++) {
- my $h = ${$g}[${$f2}[$i]];
+ my $h = ${$g}[$i*2+1];
print " ", defined($h) ? $h : 'UNUSED', ",\n";
}
print " };\n";