diff --git a/src/move-gen.c b/src/move-gen.c index 0725d1c..e14f646 100644 --- a/src/move-gen.c +++ b/src/move-gen.c @@ -259,8 +259,9 @@ static inline __unused move_t *gen_pseudo_king(move_t *moves, square_t from, * * @Return: New @moves. */ -static inline __unused move_t *moves_gen_flags(move_t *moves, square_t from, bitboard_t to_bb, - __unused move_flags_t flags) +static inline __unused move_t *moves_gen_flags(move_t *moves, square_t from, + bitboard_t to_bb, + __unused move_flags_t flags) { square_t to; while(to_bb) { @@ -285,7 +286,8 @@ static inline __unused move_t *moves_gen_flags(move_t *moves, square_t from, bit */ static inline move_t *move_gen_promotions(move_t *moves, square_t from, square_t to) { - for (piece_type_t pt = QUEEN; pt >= KNIGHT; --pt) + /* your attention: "downto operator" */ + for (piece_type_t pt = QUEEN - 1; pt --> KNIGHT - 2;) *moves++ = move_make_promote(from, to, pt); return moves; } diff --git a/src/move.h b/src/move.h index 4373f2f..1f62050 100644 --- a/src/move.h +++ b/src/move.h @@ -119,8 +119,7 @@ static inline move_t move_make_enpassant(square_t from, square_t to) static inline move_t move_make_promote(square_t from, square_t to, piece_type_t promoted) { - return move_make_flags(from, to, M_PROMOTION) | - ((promoted - KNIGHT) << M_OFF_PROMOTED); + return move_make_flags(from, to, M_PROMOTION) | (promoted << M_OFF_PROMOTED); } /*