X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=4d3f32a4d984d3b8edc5c92a3aff05d808098078;hp=4be0a231d5ef4226c6b4b6d3abce68b3697c363d;hb=90ec4a403ae326b85dfa68afd5fd7ed47d5bc651;hpb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83 diff --git a/src/position.cpp b/src/position.cpp index 4be0a231..4d3f32a4 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -25,6 +25,7 @@ #include "bitcount.h" #include "movegen.h" +#include "notation.h" #include "position.h" #include "psqtab.h" #include "rkiss.h" @@ -89,7 +90,7 @@ CheckInfo::CheckInfo(const Position& pos) { /// object do not depend on any external data so we detach state pointer from /// the source one. -void Position::operator=(const Position& pos) { +Position& Position::operator=(const Position& pos) { memcpy(this, &pos, sizeof(Position)); startState = *st; @@ -97,6 +98,8 @@ void Position::operator=(const Position& pos) { nodes = 0; assert(pos_is_ok()); + + return *this; } @@ -357,7 +360,7 @@ Bitboard Position::hidden_checkers() const { while (pinners) { - b = between_bb(ksq, pop_1st_bit(&pinners)) & pieces(); + b = between_bb(ksq, pop_lsb(&pinners)) & pieces(); if (b && !more_than_one(b) && (b & pieces(sideToMove))) result |= b; @@ -595,7 +598,7 @@ bool Position::is_pseudo_legal(const Move m) const { if (type_of(pc) != KING) { Bitboard b = checkers(); - Square checksq = pop_1st_bit(&b); + Square checksq = pop_lsb(&b); if (b) // double check ? In this case a king move is required return false; @@ -1321,7 +1324,7 @@ Key Position::compute_key() const { for (Bitboard b = pieces(); b; ) { - Square s = pop_1st_bit(&b); + Square s = pop_lsb(&b); k ^= zobrist[color_of(piece_on(s))][type_of(piece_on(s))][s]; } @@ -1347,7 +1350,7 @@ Key Position::compute_pawn_key() const { for (Bitboard b = pieces(PAWN); b; ) { - Square s = pop_1st_bit(&b); + Square s = pop_lsb(&b); k ^= zobrist[color_of(piece_on(s))][PAWN][s]; } @@ -1384,7 +1387,7 @@ Score Position::compute_psq_score() const { for (Bitboard b = pieces(); b; ) { - Square s = pop_1st_bit(&b); + Square s = pop_lsb(&b); score += pieceSquareTable[piece_on(s)][s]; } @@ -1475,7 +1478,7 @@ void Position::init() { Bitboard b = cr; while (b) { - Key k = zobCastle[1ULL << pop_1st_bit(&b)]; + Key k = zobCastle[1ULL << pop_lsb(&b)]; zobCastle[cr] ^= k ? k : rk.rand(); } }