@@ -665,7 +665,7 @@ namespace {
665665 assert (0 <= ss->ply && ss->ply < MAX_PLY);
666666
667667 ss->currentMove = (ss+1 )->excludedMove = bestMove = MOVE_NONE;
668- ss->cms = nullptr ;
668+ ss->counterMoves = nullptr ;
669669 (ss+1 )->skipEarlyPruning = false ;
670670 (ss+2 )->killers [0 ] = (ss+2 )->killers [1 ] = MOVE_NONE;
671671
@@ -789,7 +789,7 @@ namespace {
789789 && pos.non_pawn_material (pos.side_to_move ()))
790790 {
791791 ss->currentMove = MOVE_NULL;
792- ss->cms = nullptr ;
792+ ss->counterMoves = nullptr ;
793793
794794 assert (eval - beta >= 0 );
795795
@@ -838,14 +838,14 @@ namespace {
838838 assert ((ss-1 )->currentMove != MOVE_NONE);
839839 assert ((ss-1 )->currentMove != MOVE_NULL);
840840
841- MovePicker mp (pos, ttMove, thisThread-> history , PieceValue[MG][pos.captured_piece_type ()]);
841+ MovePicker mp (pos, ttMove, PieceValue[MG][pos.captured_piece_type ()]);
842842 CheckInfo ci (pos);
843843
844844 while ((move = mp.next_move ()) != MOVE_NONE)
845845 if (pos.legal (move, ci.pinned ))
846846 {
847847 ss->currentMove = move;
848- ss->cms = &CounterMoveHistory[pos.moved_piece (move)][to_sq (move)];
848+ ss->counterMoves = &CounterMoveHistory[pos.moved_piece (move)][to_sq (move)];
849849 pos.do_move (move, st, pos.gives_check (move, ci));
850850 value = -search<NonPV>(pos, ss+1 , -rbeta, -rbeta+1 , rdepth, !cutNode);
851851 pos.undo_move (move);
@@ -871,10 +871,9 @@ namespace {
871871moves_loop: // When in check search starts from here
872872
873873 Square prevSq = to_sq ((ss-1 )->currentMove );
874- Move cm = thisThread->counterMoves [pos.piece_on (prevSq)][prevSq];
875- const CounterMoveStats * cmh = &CounterMoveHistory[pos.piece_on (prevSq)][prevSq];
874+ const CounterMoveStats& cmh = CounterMoveHistory[pos.piece_on (prevSq)][prevSq];
876875
877- MovePicker mp (pos, ttMove, depth, thisThread-> history , cm, ss);
876+ MovePicker mp (pos, ttMove, depth, ss);
878877 CheckInfo ci (pos);
879878 value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
880879 improving = ss->staticEval >= (ss-2 )->staticEval
@@ -968,8 +967,7 @@ namespace {
968967 if ( depth <= 4 * ONE_PLY
969968 && move != ss->killers [0 ]
970969 && thisThread->history [pos.moved_piece (move)][to_sq (move)] < VALUE_ZERO
971- && cmh
972- && (*cmh)[pos.moved_piece (move)][to_sq (move)] < VALUE_ZERO)
970+ && cmh[pos.moved_piece (move)][to_sq (move)] < VALUE_ZERO)
973971 continue ;
974972
975973 predictedDepth = std::max (newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO);
@@ -1002,7 +1000,7 @@ namespace {
10021000 }
10031001
10041002 ss->currentMove = move;
1005- ss->cms = &CounterMoveHistory[pos.moved_piece (move)][to_sq (move)];
1003+ ss->counterMoves = &CounterMoveHistory[pos.moved_piece (move)][to_sq (move)];
10061004
10071005 // Step 14. Make the move
10081006 pos.do_move (move, st, givesCheck);
@@ -1015,7 +1013,7 @@ namespace {
10151013 {
10161014 Depth r = reduction<PvNode>(improving, depth, moveCount);
10171015 Value hValue = thisThread->history [pos.piece_on (to_sq (move))][to_sq (move)];
1018- Value cmhValue = cmh ? (*cmh) [pos.piece_on (to_sq (move))][to_sq (move)] : VALUE_ZERO ;
1016+ Value cmhValue = cmh[pos.piece_on (to_sq (move))][to_sq (move)];
10191017
10201018 // Increase reduction for cut nodes and moves with a bad history
10211019 if ( (!PvNode && cutNode)
@@ -1164,17 +1162,17 @@ namespace {
11641162 && !bestMove
11651163 && !inCheck
11661164 && !pos.captured_piece_type ()
1167- && is_ok ((ss - 1 )->currentMove ))
1165+ && is_ok ((ss- 1 )->currentMove ))
11681166 {
11691167 Value bonus = Value ((depth / ONE_PLY) * (depth / ONE_PLY) + depth / ONE_PLY - 1 );
1170- if ((ss-2 )->cms ) // prevCmh
1171- (ss-2 )->cms ->update (pos.piece_on (prevSq), prevSq, bonus);
1168+ if ((ss-2 )->counterMoves )
1169+ (ss-2 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, bonus);
11721170
1173- if ((ss-3 )->cms ) // prevFmh
1174- (ss-3 )->cms ->update (pos.piece_on (prevSq), prevSq, bonus);
1171+ if ((ss-3 )->counterMoves )
1172+ (ss-3 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, bonus);
11751173
1176- if ((ss-5 )->cms ) // prevFmh2
1177- (ss-5 )->cms ->update (pos.piece_on (prevSq), prevSq, bonus);
1174+ if ((ss-5 )->counterMoves )
1175+ (ss-5 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, bonus);
11781176 }
11791177
11801178 tte->save (posKey, value_to_tt (bestValue, ss->ply ),
@@ -1295,7 +1293,7 @@ namespace {
12951293 // to search the moves. Because the depth is <= 0 here, only captures,
12961294 // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
12971295 // be generated.
1298- MovePicker mp (pos, ttMove, depth, pos. this_thread ()-> history , to_sq ((ss-1 )->currentMove ));
1296+ MovePicker mp (pos, ttMove, depth, to_sq ((ss-1 )->currentMove ));
12991297 CheckInfo ci (pos);
13001298
13011299 // Loop through the moves until no moves remain or a beta cutoff occurs
@@ -1449,9 +1447,9 @@ namespace {
14491447 Value bonus = Value ((depth / ONE_PLY) * (depth / ONE_PLY) + depth / ONE_PLY - 1 );
14501448
14511449 Square prevSq = to_sq ((ss-1 )->currentMove );
1452- CounterMoveStats * cmh = (ss-1 )->cms ;
1453- CounterMoveStats * fmh = (ss-2 )->cms ;
1454- CounterMoveStats * fmh2 = (ss-4 )->cms ;
1450+ CounterMoveStats* cmh = (ss-1 )->counterMoves ;
1451+ CounterMoveStats* fmh = (ss-2 )->counterMoves ;
1452+ CounterMoveStats* fmh2 = (ss-4 )->counterMoves ;
14551453 Thread* thisThread = pos.this_thread ();
14561454
14571455 thisThread->history .update (pos.moved_piece (move), to_sq (move), bonus);
@@ -1484,17 +1482,16 @@ namespace {
14841482 }
14851483
14861484 // Extra penalty for a quiet TT move in previous ply when it gets refuted
1487- if ( (ss-1 )->moveCount == 1
1488- && !pos.captured_piece_type ())
1485+ if ((ss-1 )->moveCount == 1 && !pos.captured_piece_type ())
14891486 {
1490- if ((ss-2 )->cms ) // prevCmh
1491- (ss-2 )->cms ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
1487+ if ((ss-2 )->counterMoves )
1488+ (ss-2 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
14921489
1493- if ((ss-3 )->cms ) // prevFmh
1494- (ss-3 )->cms ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
1490+ if ((ss-3 )->counterMoves )
1491+ (ss-3 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
14951492
1496- if ((ss-5 )->cms ) // prevFmh2
1497- (ss-5 )->cms ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
1493+ if ((ss-5 )->counterMoves )
1494+ (ss-5 )->counterMoves ->update (pos.piece_on (prevSq), prevSq, -bonus - 2 * (depth + 1 ) / ONE_PLY);
14981495 }
14991496 }
15001497
0 commit comments