X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=c275109d4bc0e967f9ca55b4b0b9d8d629931640;hp=2c71c680e9f857485a931a350e3bf69ed9afd9c2;hb=6becc8144686b9a40d8dc9d5e0ce4dec28cbcb6a;hpb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83 diff --git a/src/movegen.cpp b/src/movegen.cpp index 2c71c680..c275109d 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -25,10 +25,10 @@ /// Simple macro to wrap a very common while loop, no facny, no flexibility, /// hardcoded names 'mlist' and 'from'. -#define SERIALIZE(b) while (b) (*mlist++).move = make_move(from, pop_1st_bit(&b)) +#define SERIALIZE(b) while (b) (*mlist++).move = make_move(from, pop_lsb(&b)) /// Version used for pawns, where the 'from' square is given as a delta from the 'to' square -#define SERIALIZE_PAWNS(b, d) while (b) { Square to = pop_1st_bit(&b); \ +#define SERIALIZE_PAWNS(b, d) while (b) { Square to = pop_lsb(&b); \ (*mlist++).move = make_move(to - (d), to); } namespace { @@ -59,7 +59,7 @@ namespace { && (pos.attackers_to(kto, pos.pieces() ^ rfrom) & enemies)) return mlist; - (*mlist++).move = make_castle(kfrom, rfrom); + (*mlist++).move = make(kfrom, rfrom); if (OnlyChecks && !pos.move_gives_check((mlist - 1)->move, CheckInfo(pos))) mlist--; @@ -87,22 +87,22 @@ namespace { while (b) { - Square to = pop_1st_bit(&b); + Square to = pop_lsb(&b); if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS) - (*mlist++).move = make_promotion(to - Delta, to, QUEEN); + (*mlist++).move = make(to - Delta, to, QUEEN); if (Type == QUIETS || Type == EVASIONS || Type == NON_EVASIONS) { - (*mlist++).move = make_promotion(to - Delta, to, ROOK); - (*mlist++).move = make_promotion(to - Delta, to, BISHOP); - (*mlist++).move = make_promotion(to - Delta, to, KNIGHT); + (*mlist++).move = make(to - Delta, to, ROOK); + (*mlist++).move = make(to - Delta, to, BISHOP); + (*mlist++).move = make(to - Delta, to, KNIGHT); } // Knight-promotion is the only one that can give a direct check not // already included in the queen-promotion. if (Type == QUIET_CHECKS && (StepAttacksBB[W_KNIGHT][to] & ksq)) - (*mlist++).move = make_promotion(to - Delta, to, KNIGHT); + (*mlist++).move = make(to - Delta, to, KNIGHT); else (void)ksq; // Silence a warning under MSVC } @@ -207,7 +207,7 @@ namespace { assert(b1); while (b1) - (*mlist++).move = make_enpassant(pop_1st_bit(&b1), pos.ep_square()); + (*mlist++).move = make(pop_lsb(&b1), pos.ep_square()); } } @@ -343,7 +343,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { while (dc) { - Square from = pop_1st_bit(&dc); + Square from = pop_lsb(&dc); PieceType pt = type_of(pos.piece_on(from)); if (pt == PAWN) @@ -398,7 +398,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { do { checkersCnt++; - checksq = pop_1st_bit(&b); + checksq = pop_lsb(&b); assert(color_of(pos.piece_on(checksq)) == ~us);