Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 15 Jun 2019 13:45:57 +0000 (15:45 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 15 Jun 2019 13:45:57 +0000 (15:45 +0200)
No functional change.

1  2 
src/position.cpp

@@@ -512,29 -399,9 +518,21 @@@ void Position::set_state(StateInfo* si
  
    si->key ^= Zobrist::castling[si->castlingRights];
  
-   for (Bitboard b = pieces(PAWN); b; )
-   {
-       Square s = pop_lsb(&b);
-       si->pawnKey ^= Zobrist::psq[piece_on(s)][s];
-   }
 -  for (Piece pc : Pieces)
 -      for (int cnt = 0; cnt < pieceCount[pc]; ++cnt)
 -          si->materialKey ^= Zobrist::psq[pc][cnt];
 +  for (Color c = WHITE; c <= BLACK; ++c)
 +      for (PieceType pt = PAWN; pt <= KING; ++pt)
 +      {
 +          Piece pc = make_piece(c, pt);
-           if (pt != PAWN && pt != KING)
-               si->nonPawnMaterial[c] += pieceCount[pc] * PieceValue[MG][pc];
 +
 +          for (int cnt = 0; cnt < pieceCount[pc]; ++cnt)
 +              si->materialKey ^= Zobrist::psq[pc][cnt];
 +
 +          if (piece_drops())
 +              si->key ^= Zobrist::inHand[pc][pieceCountInHand[c][pt]];
 +      }
 +
 +  if (max_check_count())
 +      for (Color c = WHITE; c <= BLACK; ++c)
 +          si->key ^= Zobrist::checks[c][si->checksGiven[c]];
  }