mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 10:06:26 +08:00
Use a bit less code to calculate hashfull() (#1830)
* Use a bit less code to calculate hashfull(). Change post increment to preincrement as is more standard in the rest of stockfish. Scale result so we report 100% instead of 99.9% when completely full. No functional change.
This commit is contained in:
committed by
Marco Costalba
parent
ae5d2c38e1
commit
656aad8b0c
15
src/tt.cpp
15
src/tt.cpp
@@ -85,7 +85,7 @@ void TranspositionTable::clear() {
|
|||||||
|
|
||||||
std::vector<std::thread> threads;
|
std::vector<std::thread> threads;
|
||||||
|
|
||||||
for (size_t idx = 0; idx < Options["Threads"]; idx++)
|
for (size_t idx = 0; idx < Options["Threads"]; ++idx)
|
||||||
{
|
{
|
||||||
threads.emplace_back([this, idx]() {
|
threads.emplace_back([this, idx]() {
|
||||||
|
|
||||||
@@ -148,12 +148,9 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
|
|||||||
int TranspositionTable::hashfull() const {
|
int TranspositionTable::hashfull() const {
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (int i = 0; i < 1000 / ClusterSize; i++)
|
for (int i = 0; i < 1000 / ClusterSize; ++i)
|
||||||
{
|
for (int j = 0; j < ClusterSize; ++j)
|
||||||
const TTEntry* tte = &table[i].entry[0];
|
cnt += (table[i].entry[j].genBound8 & 0xFC) == generation8;
|
||||||
for (int j = 0; j < ClusterSize; j++)
|
|
||||||
if ((tte[j].genBound8 & 0xFC) == generation8)
|
return cnt * 1000 / (ClusterSize * (1000 / ClusterSize));
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
return cnt;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user