1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Small Major/Minor piece key simplification/optimization.

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

No functional change
This commit is contained in:
mstembera 2024-12-07 15:28:02 -08:00 committed by Disservin
parent afaf3a0f2a
commit a8b6bf1b1a

View file

@ -360,7 +360,7 @@ void Position::set_state() const {
{
st->nonPawnMaterial[color_of(pc)] += PieceValue[pc];
if (type_of(pc) == QUEEN || type_of(pc) == ROOK)
if (type_of(pc) >= ROOK)
st->majorPieceKey ^= Zobrist::psq[pc][s];
else
@ -759,7 +759,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
st->nonPawnMaterial[them] -= PieceValue[captured];
st->nonPawnKey[them] ^= Zobrist::psq[captured][capsq];
if (type_of(captured) == QUEEN || type_of(captured) == ROOK)
if (type_of(captured) >= ROOK)
st->majorPieceKey ^= Zobrist::psq[captured][capsq];
else
@ -844,7 +844,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
st->materialKey ^=
Zobrist::psq[promotion][pieceCount[promotion] - 1] ^ Zobrist::psq[pc][pieceCount[pc]];
if (promotionType == QUEEN || promotionType == ROOK)
if (promotionType >= ROOK)
st->majorPieceKey ^= Zobrist::psq[promotion][to];
else
@ -871,7 +871,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
st->minorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to];
}
else if (type_of(pc) == QUEEN || type_of(pc) == ROOK)
else if (type_of(pc) >= ROOK)
st->majorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to];
else