- if (!tte[i].key16 || tte[i].key16 == key16) // Empty or overwrite old
- {
- // Save preserving any existing ttMove
- tte[i].save(key16, v, b, d, m ? m : tte[i].move(), generation, statV);
- return;
- }
- }
-
- // Implement replace strategy
- TTEntry* replace = tte;
- for (unsigned i = 1; i < TTClusterSize; ++i)
- {
- if ( (( tte[i].genBound8 & 0xFC) == generation || tte[i].bound() == BOUND_EXACT)
- - ((replace->genBound8 & 0xFC) == generation)
- - (tte[i].depth8 < replace->depth8) < 0)
- replace = &tte[i];
+ const TTEntry* tte = &table[i].entry[0];
+ for (int j = 0; j < ClusterSize; j++)
+ if ((tte[j].genBound8 & 0xFC) == generation8)
+ cnt++;