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 /pptok.pl | |
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 'pptok.pl')
-rwxr-xr-x | pptok.pl | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -191,8 +191,8 @@ if ($what eq 'c') { print OUT " while ((c = *p++) != 0) {\n"; print OUT " uint32_t kn1, kn2;\n"; print OUT " c |= 0x20; /* convert to lower case */\n"; - printf OUT " kn1 = rot(k1,%2d) - rot(k2,%2d) + c;\n", ${$sv}[0], ${$sv}[1]; - printf OUT " kn2 = rot(k2,%2d) - rot(k1,%2d) + c;\n", ${$sv}[2], ${$sv}[3]; + printf OUT " kn1 = rot(k1,%2d)^(rot(k2,%2d) + c);\n", ${$sv}[0], ${$sv}[1]; + printf OUT " kn2 = rot(k2,%2d)^(rot(k1,%2d) + c);\n", ${$sv}[2], ${$sv}[3]; print OUT " k1 = kn1; k2 = kn2;\n"; print OUT " }\n"; print OUT "\n"; |