X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=d0e2d729c8c766e883092277bfc5fd97b2bb58e2;hp=bb49a824519a52b97828b1a6055d2e12cc8f198b;hb=60c121f3b1ee7d5ced3435cc1718e4e6e6fd8383;hpb=45eac9507c87df81859a09a8c68d21f1efe7942a 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; +}