Simplify away ValueListInserter

plus minor cleanups

STC: https://tests.stockfishchess.org/tests/view/616f059b40f619782fd4f73f
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 84992 W: 21244 L: 21197 D: 42551
Ptnml(0-2): 279, 9005, 23868, 9078, 266

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

No functional change
This commit is contained in:
mstembera
2021-10-19 10:49:02 -07:00
committed by Joost VandeVondele
parent 8a8640a761
commit 644f6d4790
4 changed files with 24 additions and 42 deletions

View File

@@ -39,7 +39,7 @@ namespace Stockfish::Eval::NNUE::Features {
void HalfKAv2_hm::append_active_indices(
const Position& pos,
Color perspective,
ValueListInserter<IndexType> active
IndexList& active
) {
Square ksq = pos.square<KING>(perspective);
Bitboard bb = pos.pieces();
@@ -55,22 +55,20 @@ namespace Stockfish::Eval::NNUE::Features {
void HalfKAv2_hm::append_changed_indices(
Square ksq,
StateInfo* st,
const DirtyPiece& dp,
Color perspective,
ValueListInserter<IndexType> removed,
ValueListInserter<IndexType> added
IndexList& removed,
IndexList& added
) {
const auto& dp = st->dirtyPiece;
for (int i = 0; i < dp.dirty_num; ++i) {
Piece pc = dp.piece[i];
if (dp.from[i] != SQ_NONE)
removed.push_back(make_index(perspective, dp.from[i], pc, ksq));
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], pc, ksq));
added.push_back(make_index(perspective, dp.to[i], dp.piece[i], ksq));
}
}
int HalfKAv2_hm::update_cost(StateInfo* st) {
int HalfKAv2_hm::update_cost(const StateInfo* st) {
return st->dirtyPiece.dirty_num;
}
@@ -78,7 +76,7 @@ namespace Stockfish::Eval::NNUE::Features {
return pos.count<ALL_PIECES>();
}
bool HalfKAv2_hm::requires_refresh(StateInfo* st, Color perspective) {
bool HalfKAv2_hm::requires_refresh(const StateInfo* st, Color perspective) {
return st->dirtyPiece.piece[0] == make_piece(perspective, KING);
}