From: Marco Costalba Date: Mon, 31 Aug 2009 10:33:44 +0000 (+0200) Subject: Use pointers instead of array indices also for badCaptures X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=c9d364f9caf5bdbd61d1fcbe85142d4ebaafad7c Use pointers instead of array indices also for badCaptures To have uniformity with moves array handling. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/movepick.cpp b/src/movepick.cpp index 5c0f4f5b..dedfee8a 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -73,7 +73,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, ttMoves[1].move = killers[0].move = killers[1].move = MOVE_NONE; finished = false; - numOfBadCaptures = 0; + lastBadCapture = badCaptures; Color us = pos.side_to_move(); @@ -129,7 +129,7 @@ void MovePicker::go_next_phase() { // Bad captures SEE value is already calculated so just sort them // to get SEE move ordering. curMove = badCaptures; - lastMove = badCaptures + numOfBadCaptures; + lastMove = lastBadCapture; std::sort(badCaptures, lastMove); return; @@ -278,9 +278,10 @@ Move MovePicker::get_next_move() { // Losing capture, move it to the badCaptures[] array, note // that move has now been already checked for legality. - assert(numOfBadCaptures < 63); - badCaptures[numOfBadCaptures].move = move; - badCaptures[numOfBadCaptures++].score = seeValue; + assert(int(lastBadCapture - badCaptures) < 63); + lastBadCapture->move = move; + lastBadCapture->score = seeValue; + lastBadCapture++; } break; diff --git a/src/movepick.h b/src/movepick.h index 147d5d0b..27adb101 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -80,9 +80,9 @@ private: const History& H; MoveStack ttMoves[2], killers[2]; bool finished; - int numOfBadCaptures, phase; + int phase; const MovegenPhaseT* phasePtr; - MoveStack *curMove, *lastMove; + MoveStack *curMove, *lastMove, *lastBadCapture; Bitboard dc, pinned; MoveStack moves[256], badCaptures[64]; };