/// 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;
nodes = 0;
assert(pos_is_ok());
+
+ return *this;
}
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;
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;
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];
}
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];
}
for (Bitboard b = pieces(); b; )
{
- Square s = pop_1st_bit(&b);
+ Square s = pop_lsb(&b);
score += pieceSquareTable[piece_on(s)][s];
}
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<Key>();
}
}