]> git.sesse.net Git - stockfish/blobdiff - src/movepick.cpp
Prefer int to uint8_t when possible
[stockfish] / src / movepick.cpp
index b0469a66abd5f08ce6facf8754ea1344f895e887..264d941f602b45368c5871afa87e6a6d16691da0 100644 (file)
@@ -51,10 +51,10 @@ namespace {
   };
 
   CACHE_LINE_ALIGNMENT
-  const uint8_t MainSearchPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
-  const uint8_t EvasionsPhaseTable[] = { PH_TT_MOVES, PH_EVASIONS, PH_STOP};
-  const uint8_t QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
-  const uint8_t QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
+  const int MainSearchPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
+  const int EvasionsPhaseTable[] = { PH_TT_MOVES, PH_EVASIONS, PH_STOP};
+  const int QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
+  const int QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
 }
 
 
@@ -75,7 +75,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
   int searchTT = ttm;
   ttMoves[0].move = ttm;
   badCaptureThreshold = 0;
-  lastBadCapture = badCaptures;
+  badCaptures = moves + MOVES_MAX;
 
   pinned = p.pinned_pieces(pos.side_to_move());
 
@@ -148,10 +148,10 @@ void MovePicker::go_next_phase() {
       return;
 
   case PH_BAD_CAPTURES:
-      // Bad captures SEE value is already calculated so just sort them
-      // to get SEE move ordering.
+      // Bad captures SEE value is already calculated so just pick
+      // them in order to get SEE move ordering.
       curMove = badCaptures;
-      lastMove = lastBadCapture;
+      lastMove = moves + MOVES_MAX;
       return;
 
   case PH_EVASIONS:
@@ -292,12 +292,10 @@ Move MovePicker::get_next_move() {
                   if (seeValue >= badCaptureThreshold)
                       return move;
 
-                  // Losing capture, move it to the badCaptures[] array, note
+                  // Losing capture, move it to the tail of the array, note
                   // that move has now been already checked for legality.
-                  assert(int(lastBadCapture - badCaptures) < 63);
-                  lastBadCapture->move = move;
-                  lastBadCapture->score = seeValue;
-                  lastBadCapture++;
+                  (--badCaptures)->move = move;
+                  badCaptures->score = seeValue;
               }
               break;