Simplify newly introduced castling_is_check()
authorMarco Costalba <mcostalba@gmail.com>
Fri, 6 Feb 2009 15:40:30 +0000 (16:40 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 7 Feb 2009 12:26:50 +0000 (13:26 +0100)
Use bit_is_set() instead of open coding.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movegen.cpp

index 9c405defab4b75e9845e18ec809fc1310843669d..5917c9e486a7a92e46af70298ba5e227b1f29aa4 100644 (file)
@@ -945,11 +945,10 @@ namespace {
     File rookFile = (side == QUEEN_SIDE ? FILE_D : FILE_F);
     Color us = pos.side_to_move();
     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
     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)));
   }
 }