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:
Marco Costalba
2009-06-20 08:31:39 +01:00
parent b1e79fed99
commit 3a4d6e2034
7 changed files with 30 additions and 26 deletions

View File

@@ -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));
}