Skip to content

Commit 67115d5

Browse files
ddobbelaeremooskagh
authored andcommitted
Fix compiler comparison warnings. (LeelaChessZero#790)
1 parent 45e353b commit 67115d5

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/mcts/search.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ std::vector<std::string> Search::GetVerboseStats(Node* node,
239239
oss << "(Q: " << std::setw(8) << std::setprecision(5) << edge.GetQ(fpu)
240240
<< ") ";
241241

242-
oss << "(D: " << std::setw(6) << std::setprecision(3)
243-
<< edge.GetD() << ") ";
242+
oss << "(D: " << std::setw(6) << std::setprecision(3) << edge.GetD()
243+
<< ") ";
244244

245245
oss << "(U: " << std::setw(6) << std::setprecision(5) << edge.GetU(U_coeff)
246246
<< ") ";
@@ -327,12 +327,12 @@ void Search::UpdateKLDGain() {
327327
if (prev_dist_.size() != 0) {
328328
double sum1 = 0.0;
329329
double sum2 = 0.0;
330-
for (int i = 0; i < new_visits.size(); i++) {
330+
for (decltype(new_visits)::size_type i = 0; i < new_visits.size(); i++) {
331331
sum1 += prev_dist_[i];
332332
sum2 += new_visits[i];
333333
}
334334
double kldgain = 0.0;
335-
for (int i = 0; i < new_visits.size(); i++) {
335+
for (decltype(new_visits)::size_type i = 0; i < new_visits.size(); i++) {
336336
double o_p = prev_dist_[i] / sum1;
337337
double n_p = new_visits[i] / sum2;
338338
if (prev_dist_[i] != 0) {
@@ -422,8 +422,8 @@ void Search::UpdateRemainingMoves() {
422422
if (time_since_start > kSmartPruningToleranceMs) {
423423
const auto nps = 1000LL *
424424
(total_playouts_ + kSmartPruningToleranceNodes) /
425-
time_since_start +
426-
1;
425+
time_since_start +
426+
1;
427427
const int64_t remaining_time = GetTimeToDeadline();
428428
// Put early_exit scaler here so calculation doesn't have to be done on
429429
// every node.
@@ -439,8 +439,8 @@ void Search::UpdateRemainingMoves() {
439439
// Add kMiniBatchSize, as it's possible to exceed visits limit by that
440440
// number.
441441
const auto remaining_visits = limits_.visits - total_playouts_ -
442-
initial_visits_ +
443-
params_.GetMiniBatchSize() - 1;
442+
initial_visits_ + params_.GetMiniBatchSize() -
443+
1;
444444

445445
if (remaining_visits < remaining_playouts_)
446446
remaining_playouts_ = remaining_visits;
@@ -498,10 +498,11 @@ bool Search::PopulateRootMoveLimit(MoveList* root_moves) const {
498498
(board.ours() | board.theirs()).count() > syzygy_tb_->max_cardinality()) {
499499
return false;
500500
}
501-
return syzygy_tb_->root_probe(played_history_.Last(),
502-
params_.GetSyzygyFastPlay() ||
503-
played_history_.DidRepeatSinceLastZeroingMove(),
504-
root_moves) ||
501+
return syzygy_tb_->root_probe(
502+
played_history_.Last(),
503+
params_.GetSyzygyFastPlay() ||
504+
played_history_.DidRepeatSinceLastZeroingMove(),
505+
root_moves) ||
505506
syzygy_tb_->root_probe_wdl(played_history_.Last(), root_moves);
506507
}
507508

@@ -558,7 +559,7 @@ std::vector<EdgeAndNode> Search::GetBestChildrenNoTemperature(Node* parent,
558559
}
559560
const auto middle = (static_cast<int>(edges.size()) > count)
560561
? edges.begin() + count
561-
: edges.end();
562+
: edges.end();
562563
std::partial_sort(edges.begin(), middle, edges.end(), std::greater<El>());
563564

564565
std::vector<EdgeAndNode> res;

0 commit comments

Comments
 (0)