]> git.sesse.net Git - stockfish/commitdiff
Inline Position::move_is_capture()
authorMarco Costalba <mcostalba@gmail.com>
Mon, 27 Apr 2009 14:35:31 +0000 (16:35 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 27 Apr 2009 14:36:33 +0000 (16:36 +0200)
This is a very hot path function, profiling on Intel compiler
shows that inlining cuts in half the overhead.

No functional change.

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

index abe75807e2869044b05aad7b1cdfd696c31594bf..2ede62feecd8d7b201baaa9044bf3c59d5241f1a 100644 (file)
@@ -651,20 +651,6 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
 }
 
 
-/// Position::move_is_capture() tests whether a move from the current
-/// position is a capture. Move must not be MOVE_NONE.
-
-bool Position::move_is_capture(Move m) const {
-
-  assert(m != MOVE_NONE);
-
-  return (   !square_is_empty(move_to(m))
-          && (color_of_piece_on(move_to(m)) != color_of_piece_on(move_from(m)))
-         )
-         || move_is_ep(m);
-}
-
-
 /// Position::update_checkers() udpates chekers info given the move. It is called
 /// in do_move() and is faster then find_checkers().
 
index d2b37478e4ce681714fc11b654986da82a016209..65bfa25807f4eb2af0ac95a3565f589ae18c5ec5 100644 (file)
@@ -718,5 +718,14 @@ inline bool Position::has_pawn_on_7th(Color c) const {
   return pawns(c) & relative_rank_bb(c, RANK_7);
 }
 
+inline bool Position::move_is_capture(Move m) const {
+
+  // Move must not be MOVE_NONE !
+
+  return (   !square_is_empty(move_to(m))
+          && (color_of_piece_on(move_to(m)) != color_of_piece_on(move_from(m)))
+         )
+         || move_is_ep(m);
+}
 
 #endif // !defined(POSITION_H_INCLUDED)