From 74cc5e569c1c8bcdd886734e1ce4c2df741b5b07 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 30 Aug 2007 22:35:34 +0000 Subject: 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. --- perllib/phash.ph | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'perllib') 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); -- cgit v1.2.3