1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Cleanup TT::hashfull()

closes https://github.com/official-stockfish/Stockfish/pull/5651

No functional change
This commit is contained in:
mstembera 2024-10-23 03:37:32 -07:00 committed by Disservin
parent 24c57793e1
commit 16fee2a7da

View file

@ -194,19 +194,12 @@ void TranspositionTable::clear(ThreadPool& threads) {
// occupation during a search. The hash is x permill full, as per UCI protocol. // occupation during a search. The hash is x permill full, as per UCI protocol.
// Only counts entries which match the current generation. // Only counts entries which match the current generation.
int TranspositionTable::hashfull(int maxAge) const { int TranspositionTable::hashfull(int maxAge) const {
int maxAgeInternal = maxAge << GENERATION_BITS;
int cnt = 0; int cnt = 0;
for (int i = 0; i < 1000; ++i) for (int i = 0; i < 1000; ++i)
for (int j = 0; j < ClusterSize; ++j) for (int j = 0; j < ClusterSize; ++j)
{ cnt += table[i].entry[j].is_occupied()
if (table[i].entry[j].is_occupied()) && table[i].entry[j].relative_age(generation8) <= maxAgeInternal;
{
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; return cnt / ClusterSize;
} }