mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Use if instead of goto
This PR inverts the if and removes goto in the generate_all function. closes https://github.com/official-stockfish/Stockfish/pull/3461 No functional change
This commit is contained in:
parent
038487f954
commit
6b9a70ace8
2 changed files with 14 additions and 14 deletions
1
AUTHORS
1
AUTHORS
|
@ -175,6 +175,7 @@ Stefan Geschwentner (locutus2)
|
|||
Stefano Cardanobile (Stefano80)
|
||||
Steinar Gunderson (sesse)
|
||||
Stéphane Nicolet (snicolet)
|
||||
Prokop Randáček (ProkopRandacek)
|
||||
Thanar2
|
||||
thaspel
|
||||
theo77186
|
||||
|
|
|
@ -192,9 +192,9 @@ namespace {
|
|||
const Square ksq = pos.square<KING>(Us);
|
||||
Bitboard target;
|
||||
|
||||
if (Type == EVASIONS && more_than_one(pos.checkers()))
|
||||
goto kingMoves; // Double check, only a king move can save the day
|
||||
|
||||
// Skip generating non-king moves when in double check
|
||||
if (Type != EVASIONS || !more_than_one(pos.checkers()))
|
||||
{
|
||||
target = Type == EVASIONS ? between_bb(ksq, lsb(pos.checkers()))
|
||||
: Type == NON_EVASIONS ? ~pos.pieces( Us)
|
||||
: Type == CAPTURES ? pos.pieces(~Us)
|
||||
|
@ -205,8 +205,7 @@ namespace {
|
|||
moveList = generate_moves<Us, BISHOP, Checks>(pos, moveList, target);
|
||||
moveList = generate_moves<Us, ROOK, Checks>(pos, moveList, target);
|
||||
moveList = generate_moves<Us, QUEEN, Checks>(pos, moveList, target);
|
||||
|
||||
kingMoves:
|
||||
}
|
||||
if (!Checks || pos.blockers_for_king(~Us) & ksq)
|
||||
{
|
||||
Bitboard b = attacks_bb<KING>(ksq) & (Type == EVASIONS ? ~pos.pieces(Us) : target);
|
||||
|
|
Loading…
Add table
Reference in a new issue