diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-18 12:38:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-18 12:38:07 -0700 |
commit | 5255fd1f36eece1cbf4000ffc3120dbcb9bf5038 (patch) | |
tree | 1b48eca6bea429f943bd77dcdf91be7e85a013c2 /perllib | |
parent | 3ce3715fba17d5ad54278a42dd0fe75a5b0ebc8d (diff) | |
download | nasm-5255fd1f36eece1cbf4000ffc3120dbcb9bf5038.tar.gz nasm-5255fd1f36eece1cbf4000ffc3120dbcb9bf5038.tar.bz2 nasm-5255fd1f36eece1cbf4000ffc3120dbcb9bf5038.zip |
Change the token prehash function for better convergence
Combining arithmetric (add) and bitwise (xor) mixing seems to give
better result than either.
With the new prehash function, we find a valid hash much quicker.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/phash.ph | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/perllib/phash.ph b/perllib/phash.ph index 6033427..3bb3a05 100644 --- a/perllib/phash.ph +++ b/perllib/phash.ph @@ -42,8 +42,8 @@ sub prehash($$$) { foreach $c (unpack("C*", $key)) { $ko1 = $k1; $ko2 = $k2; - $k1 = int32(rot($ko1,$s0)-rot($ko2, $s1)+$c); - $k2 = int32(rot($ko2,$s2)-rot($ko1, $s3)+$c); + $k1 = int32(rot($ko1,$s0)^int32(rot($ko2, $s1)+$c)); + $k2 = int32(rot($ko2,$s2)^int32(rot($ko1, $s3)+$c)); } # Create a bipartite graph... |