]> git.sesse.net Git - stockfish/commitdiff
Use do_move_bb() in move_attacks_square()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 10 Oct 2010 06:56:07 +0000 (08:56 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 10 Oct 2010 07:32:12 +0000 (08:32 +0100)
No functional change.

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

index 74cb1f4eefef8c920ce7b1da55a70153fe9c08ca..23ffbaa46593c8dad832a7ee6ebd0973a1820228 100644 (file)
@@ -523,6 +523,7 @@ bool Position::move_attacks_square(Move m, Square s) const {
   assert(move_is_ok(m));
   assert(square_is_ok(s));
 
+  Bitboard occ, xray;
   Square f = move_from(m), t = move_to(m);
 
   assert(square_is_occupied(f));
@@ -531,12 +532,11 @@ bool Position::move_attacks_square(Move m, Square s) const {
       return true;
 
   // Move the piece and scan for X-ray attacks behind it
-  Bitboard occ = occupied_squares();
-  Color us = color_of_piece_on(f);
-  clear_bit(&occ, f);
-  set_bit(&occ, t);
-  Bitboard xray = ( (rook_attacks_bb(s, occ) &  pieces(ROOK, QUEEN))
-                   |(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN))) & pieces_of_color(us);
+  occ = occupied_squares();
+  do_move_bb(&occ, make_move_bb(f, t));
+  xray = ( (rook_attacks_bb(s, occ)   & pieces(ROOK, QUEEN))
+          |(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN)))
+         & pieces_of_color(color_of_piece_on(f));
 
   // If we have attacks we need to verify that are caused by our move
   // and are not already existent ones.