Skip to content

Commit

Permalink
clang-tidy: don't nest std::min
Browse files Browse the repository at this point in the history
Found with modernize-min-max-use-initializer-list

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Feb 6, 2025
1 parent a588d67 commit 8b38703
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/torrent/download/choke_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ choke_queue::prepare_weights(group_stats gs) {

// Aggregate the statistics... Remember to update them after
// optimistic/pessimistic unchokes.
gs.sum_min_needed += std::min(group->size_connections(), std::min(group->min_slots(), group->max_slots()));
gs.sum_min_needed += std::min({group->size_connections(), group->max_slots(), group->min_slots()});

uint32_t max_slots = std::min(group->size_connections(), group->max_slots());

Expand Down Expand Up @@ -493,7 +493,7 @@ choke_manager_allocate_slots(choke_queue::iterator first, choke_queue::iterator
if (weights[itr] == 0 || target[itr].first >= s)
continue;

uint32_t u = std::min(unchoke, std::min(s - target[itr].first, weights[itr] - start));
uint32_t u = std::min({unchoke, s - target[itr].first, weights[itr] - start});

start = 0;
unchoke -= u;
Expand Down

0 comments on commit 8b38703

Please sign in to comment.