1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Simplify newly introduced castling_is_check()

Use bit_is_set() instead of open coding.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-02-06 16:40:30 +01:00
parent 76381cbd69
commit 1156eb865b

View file

@ -945,11 +945,10 @@ namespace {
File rookFile = (side == QUEEN_SIDE ? FILE_D : FILE_F); File rookFile = (side == QUEEN_SIDE ? FILE_D : FILE_F);
Color us = pos.side_to_move(); Color us = pos.side_to_move();
Square ksq = pos.king_square(us); Square ksq = pos.king_square(us);
Bitboard occ = pos.occupied_squares(), oppKingBB = EmptyBoardBB; Bitboard occ = pos.occupied_squares();
set_bit(&oppKingBB, pos.king_square(opposite_color(us)));
clear_bit(&occ, ksq); // Remove our king from the board clear_bit(&occ, ksq); // Remove our king from the board
Square rsq = make_square(rookFile, square_rank(ksq)); Square rsq = make_square(rookFile, square_rank(ksq));
return (rook_attacks_bb(rsq, occ) & oppKingBB); return bit_is_set(rook_attacks_bb(rsq, occ), pos.king_square(opposite_color(us)));
} }
} }