mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-16 23:26:23 +08:00
Micro optimize and rename move_promotion()
Rename to move_is_promotion() to be more clear, also add a new function move_promotion_piece() to get the promotion piece type in the few places where is needed. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -506,7 +506,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
|
||||
// be a promotion.
|
||||
if ( ( (square_rank(to) == RANK_8 && us == WHITE)
|
||||
||(square_rank(to) == RANK_1 && us != WHITE))
|
||||
&& !move_promotion(m))
|
||||
&& !move_is_promotion(m))
|
||||
return false;
|
||||
|
||||
// Proceed according to the square delta between the source and
|
||||
@@ -560,7 +560,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
|
||||
// Luckly we can handle all the other pieces in one go
|
||||
return ( pos.piece_attacks_square(pos.piece_on(from), from, to)
|
||||
&& pos.pl_move_is_legal(m, pinned)
|
||||
&& !move_promotion(m));
|
||||
&& !move_is_promotion(m));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user