mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 09:43:07 -07:00
Replace min, max, clamp functions with std counterparts
This commit is contained in:
parent
3ea4c66d41
commit
63043b4927
7 changed files with 36 additions and 28 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "pieceavailabilitybar.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -46,9 +47,9 @@ QVector<float> PieceAvailabilityBar::intToFloatVector(const QVector<int> &vecin,
|
|||
|
||||
const int maxElement = *std::max_element(vecin.begin(), vecin.end());
|
||||
|
||||
// qMax because in normalization we don't want divide by 0
|
||||
// std::max because in normalization we don't want divide by 0
|
||||
// if maxElement == 0 check will be disabled please enable this line:
|
||||
// const int maxElement = qMax(*std::max_element(avail.begin(), avail.end()), 1);
|
||||
// const int maxElement = std::max(*std::max_element(avail.begin(), avail.end()), 1);
|
||||
|
||||
if (maxElement == 0)
|
||||
return result;
|
||||
|
@ -115,7 +116,7 @@ QVector<float> PieceAvailabilityBar::intToFloatVector(const QVector<int> &vecin,
|
|||
value /= ratio * maxElement;
|
||||
|
||||
// float precision sometimes gives > 1, because it's not possible to store irrational numbers
|
||||
value = qMin(value, 1.0f);
|
||||
value = std::min(value, 1.0f);
|
||||
|
||||
result[x] = value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue