Skip to content

Commit a910ba7

Browse files
joergostervondele
authored andcommitted
Simplify hashfull calculation.
We can simplify the calculation of the hashfull info by looping over exact 1,000 entries, and then divide the result by ClusterSize. Somewhat memory accesses, somewhat more accurate. Passed non-regression LTC https://tests.stockfishchess.org/tests/view/5e30079dab2d69d58394fd5d LLR: 2.94 (-2.94,2.94) {-1.50,0.50} Total: 30125 W: 3987 L: 3926 D: 22212 Ptnml(0-2): 177, 2504, 9558, 2642, 141 closes #2523 No functional change.
1 parent 71e0b53 commit a910ba7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
148148
int TranspositionTable::hashfull() const {
149149

150150
int cnt = 0;
151-
for (int i = 0; i < 1000 / ClusterSize; ++i)
151+
for (int i = 0; i < 1000; ++i)
152152
for (int j = 0; j < ClusterSize; ++j)
153153
cnt += (table[i].entry[j].genBound8 & 0xF8) == generation8;
154154

155-
return cnt * 1000 / (ClusterSize * (1000 / ClusterSize));
155+
return cnt / ClusterSize;
156156
}

0 commit comments

Comments
 (0)