Skip to content

Commit

Permalink
Clean up hashfull()
Browse files Browse the repository at this point in the history
No functional change
bench: 1283457
  • Loading branch information
mstembera committed Oct 24, 2024
1 parent 9766db8 commit 22139c9
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/tt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,14 @@ void TranspositionTable::clear(ThreadPool& threads) {
// occupation during a search. The hash is x permill full, as per UCI protocol.
// Only counts entries which match the current generation.
int TranspositionTable::hashfull(int maxAge) const {
int maxAgeInternal = maxAge << GENERATION_BITS;
int cnt = 0;
for (int i = 0; i < 1000; ++i)
for (int i = 0; i < 500; ++i)
for (int j = 0; j < ClusterSize; ++j)
{
if (table[i].entry[j].is_occupied())
{
int age = (generation8 >> GENERATION_BITS)
- ((table[i].entry[j].genBound8 & GENERATION_MASK) >> GENERATION_BITS);
if (age < 0)
age += 1 << (8 - GENERATION_BITS);
cnt += age <= maxAge;
}
}

return cnt / ClusterSize;
cnt += table[i].entry[j].is_occupied()
&& table[i].entry[j].relative_age(generation8) <= maxAgeInternal;

return cnt * 2 / ClusterSize;
}


Expand Down

0 comments on commit 22139c9

Please sign in to comment.