From: Marco Costalba Date: Mon, 16 Jan 2012 13:27:12 +0000 (+0100) Subject: Simplify pawn captures generation X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b6b8c62ba517b566facd3297c7bd7f161b891e2b Simplify pawn captures generation No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/movegen.cpp b/src/movegen.cpp index 64c44f28..64da7359 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -91,19 +91,19 @@ namespace { template inline Bitboard move_pawns(Bitboard p) { - return Delta == DELTA_N ? p << 8 : Delta == DELTA_S ? p >> 8 : - Delta == DELTA_NE ? p << 9 : Delta == DELTA_SE ? p >> 7 : - Delta == DELTA_NW ? p << 7 : Delta == DELTA_SW ? p >> 9 : p; + return Delta == DELTA_N ? p << 8 + : Delta == DELTA_S ? p >> 8 + : Delta == DELTA_NE ? (p & ~FileHBB) << 9 + : Delta == DELTA_SE ? (p & ~FileHBB) >> 7 + : Delta == DELTA_NW ? (p & ~FileABB) << 7 + : Delta == DELTA_SW ? (p & ~FileABB) >> 9 : p; } template inline MoveStack* generate_pawn_captures(MoveStack* mlist, Bitboard pawns, Bitboard target) { - const Bitboard TFileABB = ( Delta == DELTA_NE - || Delta == DELTA_SE ? FileABB : FileHBB); - - Bitboard b = move_pawns(pawns) & target & ~TFileABB; + Bitboard b = move_pawns(pawns) & target; SERIALIZE_PAWNS(b, -Delta); return mlist; } @@ -112,14 +112,8 @@ namespace { template inline MoveStack* generate_promotions(MoveStack* mlist, Bitboard pawnsOn7, Bitboard target, Square ksq) { - const Bitboard TFileABB = ( Delta == DELTA_NE - || Delta == DELTA_SE ? FileABB : FileHBB); - Bitboard b = move_pawns(pawnsOn7) & target; - if (Delta != DELTA_N && Delta != DELTA_S) - b &= ~TFileABB; - while (b) { Square to = pop_1st_bit(&b);