Use a more optimal value for the UNUSED slot

Instead of ~1/4 the range we can use ~1/3 the range for better
distance.  It is possible that using ~1/2 - 1 might be even better,
but this is a trivial tweak.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin 2016-01-29 12:05:27 -08:00
parent 02237cbfe8
commit 5a8c424d0c
4 changed files with 4 additions and 4 deletions

View file

@ -143,7 +143,7 @@ if ($output eq 'h') {
# Put a large value in unused slots. This makes it extremely unlikely
# that any combination that involves unused slot will pass the range test.
# This speeds up rejection of unrecognized tokens, i.e. identifiers.
print C "#define UNUSED 16383\n";
print C "#define UNUSED (65535/3)\n";
print C " static const int16_t hash1[$n] = {\n";
for ($i = 0; $i < $n; $i++) {

View file

@ -225,7 +225,7 @@ print OUT " };\n";
# Put a large value in unused slots. This makes it extremely unlikely
# that any combination that involves unused slot will pass the range test.
# This speeds up rejection of unrecognized tokens, i.e. identifiers.
print OUT "#define UNUSED 16383\n";
print OUT "#define UNUSED (65535/3)\n";
print OUT " static const int16_t hash1[$n] = {\n";
for ($i = 0; $i < $n; $i++) {

View file

@ -207,7 +207,7 @@ if ($what eq 'c') {
# Put a large value in unused slots. This makes it extremely unlikely
# that any combination that involves unused slot will pass the range test.
# This speeds up rejection of unrecognized tokens, i.e. identifiers.
print OUT "#define UNUSED 16383\n";
print OUT "#define UNUSED (65535/3)\n";
print OUT " static const int16_t hash1[$n] = {\n";
for ($i = 0; $i < $n; $i++) {

View file

@ -232,7 +232,7 @@ if ($output eq 'h') {
# Put a large value in unused slots. This makes it extremely unlikely
# that any combination that involves unused slot will pass the range test.
# This speeds up rejection of unrecognized tokens, i.e. identifiers.
print "#define UNUSED 16383\n";
print "#define UNUSED (65535/3)\n";
print " static const int16_t hash1[$n] = {\n";
for ($i = 0; $i < $n; $i++) {