Simplify DirtyPiece

Simplifies the DirtyPiece struct.

passed STC: https://tests.stockfishchess.org/tests/view/68054c9798cd372e3aea05d7
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 36608 W: 9641 L: 9437 D: 17530
Ptnml(0-2): 89, 3630, 10668, 3822, 95

passed LTC: https://tests.stockfishchess.org/tests/view/6805514598cd372e3aea0783
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 127620 W: 31993 L: 31894 D: 63733
Ptnml(0-2): 42, 10983, 41665, 11074, 46

closes https://github.com/official-stockfish/Stockfish/pull/6016

No functional change
This commit is contained in:
Carlos Esparza
2025-05-13 20:30:22 +02:00
committed by Disservin
parent ed6b8d179a
commit 63c6f22627
4 changed files with 44 additions and 48 deletions
+10 -8
View File
@@ -58,13 +58,15 @@ void HalfKAv2_hm::append_changed_indices(Square ksq,
const DirtyPiece& dp,
IndexList& removed,
IndexList& added) {
for (int i = 0; i < dp.dirty_num; ++i)
{
if (dp.from[i] != SQ_NONE)
removed.push_back(make_index<Perspective>(dp.from[i], dp.piece[i], ksq));
if (dp.to[i] != SQ_NONE)
added.push_back(make_index<Perspective>(dp.to[i], dp.piece[i], ksq));
}
removed.push_back(make_index<Perspective>(dp.from, dp.pc, ksq));
if (dp.to != SQ_NONE)
added.push_back(make_index<Perspective>(dp.to, dp.pc, ksq));
if (dp.remove_sq != SQ_NONE)
removed.push_back(make_index<Perspective>(dp.remove_sq, dp.remove_pc, ksq));
if (dp.add_sq != SQ_NONE)
added.push_back(make_index<Perspective>(dp.add_sq, dp.add_pc, ksq));
}
// Explicit template instantiations
@@ -78,7 +80,7 @@ template void HalfKAv2_hm::append_changed_indices<BLACK>(Square ksq,
IndexList& added);
bool HalfKAv2_hm::requires_refresh(const DirtyPiece& dirtyPiece, Color perspective) {
return dirtyPiece.piece[0] == make_piece(perspective, KING);
return dirtyPiece.pc == make_piece(perspective, KING);
}
} // namespace Stockfish::Eval::NNUE::Features