X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=d0e2d729c8c766e883092277bfc5fd97b2bb58e2;hp=bb49a824519a52b97828b1a6055d2e12cc8f198b;hb=cb2111f0b62afec5fd977e1dd4ca5843bd006956;hpb=96e36a789708164b14c873cdb2e0acac9aca57e7 diff --git a/src/tt.cpp b/src/tt.cpp index bb49a824..d0e2d729 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -94,3 +94,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; +}