Wrap all access to LineBB and add assert

This is a non-functional code style change which provides a safe access handler for LineBB.
Also includes an assert in debug mode to verify square correctness.

closes https://github.com/official-stockfish/Stockfish/pull/2719

No functional change
This commit is contained in:
protonspring
2020-06-06 21:25:32 -06:00
committed by Joost VandeVondele
parent 902309020a
commit b0eb5a1ba3
3 changed files with 18 additions and 6 deletions

View File

@@ -332,7 +332,7 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* moveList) {
// the king evasions in order to skip known illegal moves, which avoids any
// useless legality checks later on.
while (sliders)
sliderAttacks |= LineBB[ksq][pop_lsb(&sliders)] & ~pos.checkers();
sliderAttacks |= line_bb(ksq, pop_lsb(&sliders)) & ~pos.checkers();
// Generate evasions for king, capture and non capture moves
Bitboard b = attacks_bb<KING>(ksq) & ~pos.pieces(us) & ~sliderAttacks;