mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 01:37:46 +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:
+4
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user