X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=19de55ae3cbf55d15eb6624909114f843076739c;hp=66113ee8f2c4969bbe76e1cb2e3aa5e88e8c082f;hb=a3b4e9e23ca7f8949336014468b872e57da85762;hpb=ce0a95c2c013f4aa9d41a80b8f12f005fe162fcb diff --git a/src/tt.cpp b/src/tt.cpp index 66113ee8..19de55ae 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -96,3 +96,20 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { return found = false, replace; } + + +/// Returns an approximation of the hashtable occupation during a search. The +/// hash is x permill full, as per UCI protocol. + +int TranspositionTable::hashfull() const +{ + int cnt = 0; + for (int i = 0; i < 1000 / ClusterSize; i++) + { + const TTEntry* tte = &table[i].entry[0]; + for (int j = 0; j < ClusterSize; j++) + if ((tte[j].genBound8 & 0xFC) == generation8) + cnt++; + } + return cnt; +}