summaryrefslogtreecommitdiff
path: root/perllib
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-08-30 22:35:34 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-08-30 22:35:34 +0000
commit74cc5e569c1c8bcdd886734e1ce4c2df741b5b07 (patch)
tree65fdefada17611dfd77275edc131c2d2d79d6b10 /perllib
parentb1dabe44acca3ff927c024bb7875605a5439346c (diff)
downloadnasm-74cc5e569c1c8bcdd886734e1ce4c2df741b5b07.tar.gz
nasm-74cc5e569c1c8bcdd886734e1ce4c2df741b5b07.tar.bz2
nasm-74cc5e569c1c8bcdd886734e1ce4c2df741b5b07.zip
Finishing touches on perfect hash tokenizer; actually turn the thing on
Finish the perfect hash tokenizer, and actually enable it. Move stdscan() et al to a separate file, since it's not needed in any of the clients of nasmlib other than nasm itself. Run make alldeps.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/phash.ph6
1 files changed, 4 insertions, 2 deletions
diff --git a/perllib/phash.ph b/perllib/phash.ph
index 3d15370..438e466 100644
--- a/perllib/phash.ph
+++ b/perllib/phash.ph
@@ -29,11 +29,13 @@ sub prehash($$$) {
my($key, $n, $sv) = @_;
my $c;
my $k1 = 0, $k2 = 0;
+ my $kn1, $kn2;
my($s0, $s1, $s2, $s3) = @{$sv};
foreach $c (unpack("C*", $key)) {
- $k1 = (rot($k1,$s0)-rot($k2, $s1)+$c) & 0xffffffff;
- $k2 = (rot($k2,$s2)-rot($k1, $s3)+$c) & 0xffffffff;
+ $kn1 = (rot($k1,$s0)-rot($k2, $s1)+$c) & 0xffffffff;
+ $kn2 = (rot($k2,$s2)-rot($k1, $s3)+$c) & 0xffffffff;
+ $k1 = $kn1; $k2 = $kn2;
}
return ($k1 % $n, $k2 % $n);