Yes, we try to be fancy here ;-)
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
return RESULT_INVALID;
// Check if a king can be captured
return RESULT_INVALID;
// Check if a king can be captured
- if ( bit_is_set(wk_attacks(), blackKingSquare)
- || (bit_is_set(pawn_attacks(), blackKingSquare) && sideToMove == WHITE))
+ if ( (wk_attacks() & blackKingSquare)
+ || ((pawn_attacks() & blackKingSquare) && sideToMove == WHITE))
return RESULT_INVALID;
// The position is an immediate win if it is white to move and the
return RESULT_INVALID;
// The position is an immediate win if it is white to move and the
&& sideToMove == WHITE
&& whiteKingSquare != pawnSquare + DELTA_N
&& ( square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
&& sideToMove == WHITE
&& whiteKingSquare != pawnSquare + DELTA_N
&& ( square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
- || bit_is_set(wk_attacks(), pawnSquare + DELTA_N)))
+ || (wk_attacks() & (pawnSquare + DELTA_N))))
return RESULT_WIN;
// Check for known draw positions
return RESULT_WIN;
// Check for known draw positions
// Case 2: King can capture pawn
if ( sideToMove == BLACK
// Case 2: King can capture pawn
if ( sideToMove == BLACK
- && bit_is_set(bk_attacks(), pawnSquare) && !bit_is_set(wk_attacks(), pawnSquare))
+ && (bk_attacks() & pawnSquare) && !(wk_attacks() & pawnSquare))
return RESULT_DRAW;
// Case 3: Black king in front of white pawn
return RESULT_DRAW;
// Case 3: Black king in front of white pawn
{
std::cout << "+---+---+---+---+---+---+---+---+" << '\n';
for (File f = FILE_A; f <= FILE_H; f++)
{
std::cout << "+---+---+---+---+---+---+---+---+" << '\n';
for (File f = FILE_A; f <= FILE_H; f++)
- std::cout << "| " << (bit_is_set(b, make_square(f, r)) ? "X " : " ");
+ std::cout << "| " << ((b & make_square(f, r)) ? "X " : " ");
Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
if (square_is_ok(to) && square_distance(s, to) < 3)
Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
if (square_is_ok(to) && square_distance(s, to) < 3)
- set_bit(&StepAttacksBB[make_piece(c, pt)][s], to);
+ StepAttacksBB[make_piece(c, pt)][s] |= to;
}
Square RDeltas[] = { DELTA_N, DELTA_E, DELTA_S, DELTA_W };
}
Square RDeltas[] = { DELTA_N, DELTA_E, DELTA_S, DELTA_W };
for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++)
for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++)
- if (bit_is_set(PseudoAttacks[QUEEN][s1], s2))
+ if (PseudoAttacks[QUEEN][s1] & s2)
{
Square delta = (s2 - s1) / square_distance(s1, s2);
for (Square s = s1 + delta; s != s2; s += delta)
{
Square delta = (s2 - s1) / square_distance(s1, s2);
for (Square s = s1 + delta; s != s2; s += delta)
- set_bit(&BetweenBB[s1][s2], s);
+ BetweenBB[s1][s2] |= s;
square_is_ok(s) && square_distance(s, s - deltas[i]) == 1;
s += deltas[i])
{
square_is_ok(s) && square_distance(s, s - deltas[i]) == 1;
s += deltas[i])
{
- if (bit_is_set(occupied, s))
extern Bitboard PseudoAttacks[6][64];
extern Bitboard PseudoAttacks[6][64];
-/// Functions for testing whether a given bit is set in a bitboard, and for
-/// setting and clearing bits.
+/// Overloads of bitwise operators between a Bitboard and a Square for testing
+/// whether a given bit is set in a bitboard, and for setting and clearing bits.
-inline Bitboard bit_is_set(Bitboard b, Square s) {
+inline Bitboard operator&(Bitboard b, Square s) {
return b & SquareBB[s];
}
return b & SquareBB[s];
}
-inline void set_bit(Bitboard* b, Square s) {
- *b |= SquareBB[s];
+inline Bitboard& operator|=(Bitboard& b, Square s) {
+ return b |= SquareBB[s], b;
-inline void xor_bit(Bitboard* b, Square s) {
- *b ^= SquareBB[s];
-}
-
-
-/// Functions used to update a bitboard after a move. This is faster
-/// then calling a sequence of clear_bit() + set_bit()
-
-inline Bitboard make_move_bb(Square from, Square to) {
- return SquareBB[from] | SquareBB[to];
-}
-
-inline void do_move_bb(Bitboard* b, Bitboard move_bb) {
- *b ^= move_bb;
+inline Bitboard& operator^=(Bitboard& b, Square s) {
+ return b ^= SquareBB[s], b;
/// the same color of the given square.
inline Bitboard same_color_squares(Square s) {
/// the same color of the given square.
inline Bitboard same_color_squares(Square s) {
- return bit_is_set(0xAA55AA55AA55AA55ULL, s) ? 0xAA55AA55AA55AA55ULL
- : ~0xAA55AA55AA55AA55ULL;
+ return Bitboard(0xAA55AA55AA55AA55ULL) & s ? 0xAA55AA55AA55AA55ULL
+ : ~0xAA55AA55AA55AA55ULL;
// Increase bonus if supported by pawn, especially if the opponent has
// no minor piece which can exchange the outpost piece.
// Increase bonus if supported by pawn, especially if the opponent has
// no minor piece which can exchange the outpost piece.
- if (bonus && bit_is_set(ei.attackedBy[Us][PAWN], s))
+ if (bonus && (ei.attackedBy[Us][PAWN] & s))
{
if ( !pos.pieces(KNIGHT, Them)
&& !(same_color_squares(s) & pos.pieces(BISHOP, Them)))
{
if ( !pos.pieces(KNIGHT, Them)
&& !(same_color_squares(s) & pos.pieces(BISHOP, Them)))
// Decrease score if we are attacked by an enemy pawn. Remaining part
// of threat evaluation must be done later when we have full attack info.
// Decrease score if we are attacked by an enemy pawn. Remaining part
// of threat evaluation must be done later when we have full attack info.
- if (bit_is_set(ei.attackedBy[Them][PAWN], s))
+ if (ei.attackedBy[Them][PAWN] & s)
score -= ThreatenedByPawnPenalty[Piece];
// Bishop and knight outposts squares
score -= ThreatenedByPawnPenalty[Piece];
// Bishop and knight outposts squares
// Check if (without even considering any obstacles) we're too far away or doubled
if ( pliesToQueen[winnerSide] + 3 <= pliesToGo
|| (squares_in_front_of(loserSide, s) & pos.pieces(PAWN, loserSide)))
// Check if (without even considering any obstacles) we're too far away or doubled
if ( pliesToQueen[winnerSide] + 3 <= pliesToGo
|| (squares_in_front_of(loserSide, s) & pos.pieces(PAWN, loserSide)))
- xor_bit(&candidates, s);
}
// If any candidate is already a passed pawn it _may_ promote in time. We give up.
}
// If any candidate is already a passed pawn it _may_ promote in time. We give up.
// Disambiguation if we have more then one piece with destination 'to'
// note that for pawns is not needed because starting file is explicit.
attackers = pos.attackers_to(to) & pos.pieces(pt, pos.side_to_move());
// Disambiguation if we have more then one piece with destination 'to'
// note that for pawns is not needed because starting file is explicit.
attackers = pos.attackers_to(to) & pos.pieces(pt, pos.side_to_move());
- xor_bit(&attackers, from);
ambiguousMove = ambiguousFile = ambiguousRank = false;
while (attackers)
ambiguousMove = ambiguousFile = ambiguousRank = false;
while (attackers)
if (pos.is_chess960())
{
Bitboard occ = pos.occupied_squares();
if (pos.is_chess960())
{
Bitboard occ = pos.occupied_squares();
if (pos.attackers_to(kto, occ) & enemies)
return mlist;
}
if (pos.attackers_to(kto, occ) & enemies)
return mlist;
}
// Knight-promotion is the only one that can give a direct check not
// already included in the queen-promotion.
// Knight-promotion is the only one that can give a direct check not
// already included in the queen-promotion.
- if (Type == MV_QUIET_CHECK && bit_is_set(StepAttacksBB[W_KNIGHT][to], ksq))
+ if (Type == MV_QUIET_CHECK && (StepAttacksBB[W_KNIGHT][to] & ksq))
(*mlist++).move = make_promotion(to - Delta, to, KNIGHT);
else
(void)ksq; // Silence a warning under MSVC
(*mlist++).move = make_promotion(to - Delta, to, KNIGHT);
else
(void)ksq; // Silence a warning under MSVC
// An en passant capture can be an evasion only if the checking piece
// is the double pushed pawn and so is in the target. Otherwise this
// is a discovery check and we are forced to do otherwise.
// An en passant capture can be an evasion only if the checking piece
// is the double pushed pawn and so is in the target. Otherwise this
// is a discovery check and we are forced to do otherwise.
- if (Type == MV_EVASION && !bit_is_set(target, pos.ep_square() - UP))
+ if (Type == MV_EVASION && !(target & (pos.ep_square() - UP)))
return mlist;
b1 = pawnsNotOn7 & pos.attacks_from<PAWN>(pos.ep_square(), Them);
return mlist;
b1 = pawnsNotOn7 & pos.attacks_from<PAWN>(pos.ep_square(), Them);
&& !(PseudoAttacks[Pt][from] & target))
continue;
&& !(PseudoAttacks[Pt][from] & target))
continue;
- if (ci.dcCandidates && bit_is_set(ci.dcCandidates, from))
+ if (ci.dcCandidates && (ci.dcCandidates & from))
continue;
b = pos.attacks_from<Pt>(from) & target;
continue;
b = pos.attacks_from<Pt>(from) & target;
// If queen and king are far or not on a diagonal line we can safely
// remove all the squares attacked in the other direction becuase are
// not reachable by the king anyway.
// If queen and king are far or not on a diagonal line we can safely
// remove all the squares attacked in the other direction becuase are
// not reachable by the king anyway.
- if (squares_between(ksq, checksq) || !bit_is_set(PseudoAttacks[BISHOP][checksq], ksq))
+ if (squares_between(ksq, checksq) || !(PseudoAttacks[BISHOP][checksq] & ksq))
sliderAttacks |= PseudoAttacks[QUEEN][checksq];
// Otherwise we need to use real rook attacks to check if king is safe
sliderAttacks |= PseudoAttacks[QUEEN][checksq];
// Otherwise we need to use real rook attacks to check if king is safe
// full attack info to evaluate passed pawns. Only the frontmost passed
// pawn on each file is considered a true passed pawn.
if (passed && !doubled)
// full attack info to evaluate passed pawns. Only the frontmost passed
// pawn on each file is considered a true passed pawn.
if (passed && !doubled)
- set_bit(&(pi->passedPawns[Us]), s);
+ pi->passedPawns[Us] |= s;
// Score this pawn
if (isolated)
// Score this pawn
if (isolated)
// Update occupancy as if the piece is moving
occ = occupied_squares();
// Update occupancy as if the piece is moving
occ = occupied_squares();
- do_move_bb(&occ, make_move_bb(from, to));
+ occ ^= from;
+ occ ^= to;
// The piece moved in 'to' attacks the square 's' ?
// The piece moved in 'to' attacks the square 's' ?
- if (bit_is_set(attacks_from(piece, to, occ), s))
+ if (attacks_from(piece, to, occ) & s)
return true;
// Scan for possible X-ray attackers behind the moved piece
return true;
// Scan for possible X-ray attackers behind the moved piece
assert(piece_on(capsq) == make_piece(them, PAWN));
assert(piece_on(to) == NO_PIECE);
assert(piece_on(capsq) == make_piece(them, PAWN));
assert(piece_on(to) == NO_PIECE);
- xor_bit(&b, from);
- xor_bit(&b, capsq);
- set_bit(&b, to);
+ b ^= from;
+ b ^= capsq;
+ b |= to;
return !(rook_attacks_bb(ksq, b) & pieces(ROOK, QUEEN, them))
&& !(bishop_attacks_bb(ksq, b) & pieces(BISHOP, QUEEN, them));
return !(rook_attacks_bb(ksq, b) & pieces(ROOK, QUEEN, them))
&& !(bishop_attacks_bb(ksq, b) & pieces(BISHOP, QUEEN, them));
// A non-king move is legal if and only if it is not pinned or it
// is moving along the ray towards or away from the king.
return !pinned
// A non-king move is legal if and only if it is not pinned or it
// is moving along the ray towards or away from the king.
return !pinned
- || !bit_is_set(pinned, from)
|| squares_aligned(from, to_sq(m), king_square(us));
}
|| squares_aligned(from, to_sq(m), king_square(us));
}
- else if (!bit_is_set(attacks_from(pc, from), to))
+ else if (!(attacks_from(pc, from) & to))
return false;
// Evasions generator already takes care to avoid some kind of illegal moves
return false;
// Evasions generator already takes care to avoid some kind of illegal moves
if (type_of(piece_on(from)) == KING)
{
Bitboard b = occupied_squares();
if (type_of(piece_on(from)) == KING)
{
Bitboard b = occupied_squares();
if (attackers_to(to_sq(m), b) & pieces(~us))
return false;
}
if (attackers_to(to_sq(m), b) & pieces(~us))
return false;
}
// Our move must be a blocking evasion or a capture of the checking piece
target = squares_between(checksq, king_square(us)) | checkers();
// Our move must be a blocking evasion or a capture of the checking piece
target = squares_between(checksq, king_square(us)) | checkers();
- if (!bit_is_set(target, to_sq(m)))
+ if (!(target & to_sq(m)))
PieceType pt = type_of(piece_on(from));
// Direct check ?
PieceType pt = type_of(piece_on(from));
// Direct check ?
- if (bit_is_set(ci.checkSq[pt], to))
+ if (ci.checkSq[pt] & to)
return true;
// Discovery check ?
return true;
// Discovery check ?
- if (ci.dcCandidates && bit_is_set(ci.dcCandidates, from))
+ if (ci.dcCandidates && (ci.dcCandidates & from))
{
// For pawn and king moves we need to verify also direction
if ( (pt != PAWN && pt != KING)
{
// For pawn and king moves we need to verify also direction
if ( (pt != PAWN && pt != KING)
// Promotion with check ?
if (is_promotion(m))
{
// Promotion with check ?
if (is_promotion(m))
{
- xor_bit(&b, from);
- return bit_is_set(attacks_from(Piece(promotion_piece_type(m)), to, b), ksq);
+ b ^= from;
+ return attacks_from(Piece(promotion_piece_type(m)), to, b) & ksq;
}
// En passant capture with check ? We have already handled the case
}
// En passant capture with check ? We have already handled the case
if (is_enpassant(m))
{
Square capsq = make_square(file_of(to), rank_of(from));
if (is_enpassant(m))
{
Square capsq = make_square(file_of(to), rank_of(from));
- xor_bit(&b, from);
- xor_bit(&b, capsq);
- set_bit(&b, to);
+ b ^= from;
+ b ^= capsq;
+ b |= to;
return (rook_attacks_bb(ksq, b) & pieces(ROOK, QUEEN, us))
||(bishop_attacks_bb(ksq, b) & pieces(BISHOP, QUEEN, us));
}
return (rook_attacks_bb(ksq, b) & pieces(ROOK, QUEEN, us))
||(bishop_attacks_bb(ksq, b) & pieces(BISHOP, QUEEN, us));
}
kto = relative_square(us, SQ_C1);
rto = relative_square(us, SQ_D1);
}
kto = relative_square(us, SQ_C1);
rto = relative_square(us, SQ_D1);
}
- xor_bit(&b, kfrom);
- xor_bit(&b, rfrom);
- set_bit(&b, rto);
- set_bit(&b, kto);
- return bit_is_set(rook_attacks_bb(rto, b), ksq);
+ b ^= kfrom;
+ b ^= rfrom;
+ b |= rto;
+ b |= kto;
+ return rook_attacks_bb(rto, b) & ksq;
st->npMaterial[them] -= PieceValueMidgame[capture];
// Remove the captured piece
st->npMaterial[them] -= PieceValueMidgame[capture];
// Remove the captured piece
- xor_bit(&byColorBB[them], capsq);
- xor_bit(&byTypeBB[capture], capsq);
- xor_bit(&occupied, capsq);
+ byColorBB[them] ^= capsq;
+ byTypeBB[capture] ^= capsq;
+ occupied ^= capsq;
// Update piece list, move the last piece at index[capsq] position and
// shrink the list.
// Update piece list, move the last piece at index[capsq] position and
// shrink the list.
prefetch((char*)TT.first_entry(k));
// Move the piece
prefetch((char*)TT.first_entry(k));
// Move the piece
- Bitboard move_bb = make_move_bb(from, to);
- do_move_bb(&byColorBB[us], move_bb);
- do_move_bb(&byTypeBB[pt], move_bb);
- do_move_bb(&occupied, move_bb);
+ Bitboard from_to_bb = SquareBB[from] | SquareBB[to];
+ byColorBB[us] ^= from_to_bb;
+ byTypeBB[pt] ^= from_to_bb;
+ occupied ^= from_to_bb;
board[to] = board[from];
board[from] = NO_PIECE;
board[to] = board[from];
board[from] = NO_PIECE;
assert(promotion >= KNIGHT && promotion <= QUEEN);
// Replace the pawn with the promoted piece
assert(promotion >= KNIGHT && promotion <= QUEEN);
// Replace the pawn with the promoted piece
- xor_bit(&byTypeBB[PAWN], to);
- set_bit(&byTypeBB[promotion], to);
+ byTypeBB[PAWN] ^= to;
+ byTypeBB[promotion] |= to;
board[to] = make_piece(us, promotion);
// Update piece lists, move the last pawn at index[to] position
board[to] = make_piece(us, promotion);
// Update piece lists, move the last pawn at index[to] position
- if (bit_is_set(ci.checkSq[pt], to))
- st->checkersBB = SquareBB[to];
+ if (ci.checkSq[pt] & to)
+ st->checkersBB |= to;
- if (ci.dcCandidates && bit_is_set(ci.dcCandidates, from))
+ if (ci.dcCandidates && (ci.dcCandidates & from))
{
if (pt != ROOK)
st->checkersBB |= attacks_from<ROOK>(king_square(them)) & pieces(ROOK, QUEEN, us);
{
if (pt != ROOK)
st->checkersBB |= attacks_from<ROOK>(king_square(them)) & pieces(ROOK, QUEEN, us);
assert(promotion >= KNIGHT && promotion <= QUEEN);
// Replace the promoted piece with the pawn
assert(promotion >= KNIGHT && promotion <= QUEEN);
// Replace the promoted piece with the pawn
- xor_bit(&byTypeBB[promotion], to);
- set_bit(&byTypeBB[PAWN], to);
+ byTypeBB[promotion] ^= to;
+ byTypeBB[PAWN] |= to;
board[to] = make_piece(us, PAWN);
// Update piece lists, move the last promoted piece at index[to] position
board[to] = make_piece(us, PAWN);
// Update piece lists, move the last promoted piece at index[to] position
}
// Put the piece back at the source square
}
// Put the piece back at the source square
- Bitboard move_bb = make_move_bb(to, from);
- do_move_bb(&byColorBB[us], move_bb);
- do_move_bb(&byTypeBB[pt], move_bb);
- do_move_bb(&occupied, move_bb);
+ Bitboard from_to_bb = SquareBB[from] | SquareBB[to];
+ byColorBB[us] ^= from_to_bb;
+ byTypeBB[pt] ^= from_to_bb;
+ occupied ^= from_to_bb;
board[from] = board[to];
board[to] = NO_PIECE;
board[from] = board[to];
board[to] = NO_PIECE;
}
// Restore the captured piece
}
// Restore the captured piece
- set_bit(&byColorBB[them], capsq);
- set_bit(&byTypeBB[capture], capsq);
- set_bit(&occupied, capsq);
+ byColorBB[them] |= capsq;
+ byTypeBB[capture] |= capsq;
+ occupied |= capsq;
board[capsq] = make_piece(them, capture);
board[capsq] = make_piece(them, capture);
assert(piece_on(rfrom) == make_piece(us, ROOK));
// Remove pieces from source squares
assert(piece_on(rfrom) == make_piece(us, ROOK));
// Remove pieces from source squares
- xor_bit(&byColorBB[us], kfrom);
- xor_bit(&byTypeBB[KING], kfrom);
- xor_bit(&occupied, kfrom);
- xor_bit(&byColorBB[us], rfrom);
- xor_bit(&byTypeBB[ROOK], rfrom);
- xor_bit(&occupied, rfrom);
+ byColorBB[us] ^= kfrom;
+ byTypeBB[KING] ^= kfrom;
+ occupied ^= kfrom;
+ byColorBB[us] ^= rfrom;
+ byTypeBB[ROOK] ^= rfrom;
+ occupied ^= rfrom;
// Put pieces on destination squares
// Put pieces on destination squares
- set_bit(&byColorBB[us], kto);
- set_bit(&byTypeBB[KING], kto);
- set_bit(&occupied, kto);
- set_bit(&byColorBB[us], rto);
- set_bit(&byTypeBB[ROOK], rto);
- set_bit(&occupied, rto);
+ byColorBB[us] |= kto;
+ byTypeBB[KING] |= kto;
+ occupied |= kto;
+ byColorBB[us] |= rto;
+ byTypeBB[ROOK] |= rto;
+ occupied |= rto;
// Update board
Piece king = make_piece(us, KING);
// Update board
Piece king = make_piece(us, KING);
assert(type_of(piece_on(capQq)) == PAWN);
// Remove the captured pawn
assert(type_of(piece_on(capQq)) == PAWN);
// Remove the captured pawn
capturedType = PAWN;
}
// Find all attackers to the destination square, with the moving piece
// removed, but possibly an X-ray attacker added behind it.
capturedType = PAWN;
}
// Find all attackers to the destination square, with the moving piece
// removed, but possibly an X-ray attacker added behind it.
attackers = attackers_to(to, occ);
// If the opponent has no attackers we are finished
attackers = attackers_to(to, occ);
// If the opponent has no attackers we are finished
index[s] = pieceCount[c][pt]++;
pieceList[c][pt][index[s]] = s;
index[s] = pieceCount[c][pt]++;
pieceList[c][pt][index[s]] = s;
- set_bit(&byTypeBB[pt], s);
- set_bit(&byColorBB[c], s);
- set_bit(&occupied, s);
+ byTypeBB[pt] |= s;
+ byColorBB[c] |= s;
+ occupied |= s;
return true;
// Rule 2. Queen contact check is very dangerous
return true;
// Rule 2. Queen contact check is very dangerous
- if ( type_of(pc) == QUEEN
- && bit_is_set(kingAtt, to))
+ if (type_of(pc) == QUEEN && (kingAtt & to))
return true;
// Rule 3. Creating new double threats with checks
return true;
// Rule 3. Creating new double threats with checks
// Case 3: Moving through the vacated square
p2 = pos.piece_on(f2);
// Case 3: Moving through the vacated square
p2 = pos.piece_on(f2);
- if ( piece_is_slider(p2)
- && bit_is_set(squares_between(f2, t2), f1))
+ if (piece_is_slider(p2) && (squares_between(f2, t2) & f1))
return true;
// Case 4: The destination square for m2 is defended by the moving piece in m1
p1 = pos.piece_on(t1);
return true;
// Case 4: The destination square for m2 is defended by the moving piece in m1
p1 = pos.piece_on(t1);
- if (bit_is_set(pos.attacks_from(p1, t1), t2))
+ if (pos.attacks_from(p1, t1) & t2)
return true;
// Case 5: Discovered check, checking piece is the piece moved in m1
ksq = pos.king_square(pos.side_to_move());
return true;
// Case 5: Discovered check, checking piece is the piece moved in m1
ksq = pos.king_square(pos.side_to_move());
- if ( piece_is_slider(p1)
- && bit_is_set(squares_between(t1, ksq), f2))
+ if (piece_is_slider(p1) && (squares_between(t1, ksq) & f2))
{
Bitboard occ = pos.occupied_squares();
{
Bitboard occ = pos.occupied_squares();
- xor_bit(&occ, f2);
- if (bit_is_set(pos.attacks_from(p1, t1, occ), ksq))
+ occ ^= f2;
+ if (pos.attacks_from(p1, t1, occ) & ksq)
return true;
}
return false;
return true;
}
return false;
// Case 3: If the moving piece in the threatened move is a slider, don't
// prune safe moves which block its ray.
// Case 3: If the moving piece in the threatened move is a slider, don't
// prune safe moves which block its ray.
- if ( piece_is_slider(pos.piece_on(tfrom))
- && bit_is_set(squares_between(tfrom, tto), mto)
- && pos.see_sign(m) >= 0)
+ if ( piece_is_slider(pos.piece_on(tfrom))
+ && (squares_between(tfrom, tto) & mto)
+ && pos.see_sign(m) >= 0)
return true;
return false;
return true;
return false;