X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=f2f517e219445a601f4d90690572cb1a40e1b288;hp=606c7486fc8563db19d155541435f236de61415c;hb=12461996a5bb6d4c07d4b7e464924eaaa406b01d;hpb=64d6ba2e98f29db8e853071b635ae4ebd59c24f0 diff --git a/src/position.h b/src/position.h index 606c7486..f2f517e2 100644 --- a/src/position.h +++ b/src/position.h @@ -207,6 +207,7 @@ public: bool move_is_check(Move m) const; bool move_is_check(Move m, Bitboard dcCandidates) const; bool move_is_capture(Move m) const; + bool move_is_capture_or_promotion(Move m) const; bool move_is_passed_pawn_push(Move m) const; bool move_attacks_square(Move m, Square s) const; @@ -568,8 +569,13 @@ inline bool Position::has_pawn_on_7th(Color c) const { inline bool Position::move_is_capture(Move m) const { // Move must not be MOVE_NONE ! + return (m & (3 << 15)) ? !move_is_castle(m) : !square_is_empty(move_to(m)); +} + +inline bool Position::move_is_capture_or_promotion(Move m) const { - return (!square_is_empty(move_to(m)) && !move_is_castle(m)) || move_is_ep(m); + // Move must not be MOVE_NONE ! + return (m & (0x1F << 12)) ? !move_is_castle(m) : !square_is_empty(move_to(m)); } #endif // !defined(POSITION_H_INCLUDED)