Skip to content

Commit 4c69d68

Browse files
committed
Merge #9553: Use z = std::max(x - y, 0) instead of z = x - y; if (z < 0) z = 0;
a47da4b Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; (practicalswift)
2 parents a441db0 + a47da4b commit 4c69d68

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/addrman.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ bool CAddrInfo::IsTerrible(int64_t nNow) const
5353
double CAddrInfo::GetChance(int64_t nNow) const
5454
{
5555
double fChance = 1.0;
56-
57-
int64_t nSinceLastTry = nNow - nLastTry;
58-
59-
if (nSinceLastTry < 0)
60-
nSinceLastTry = 0;
56+
int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0);
6157

6258
// deprioritize very recent attempts away
6359
if (nSinceLastTry < 60 * 10)

src/qt/coincontroldialog.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
563563
}
564564

565565
// after fee
566-
nAfterFee = nAmount - nPayFee;
567-
if (nAfterFee < 0)
568-
nAfterFee = 0;
566+
nAfterFee = std::max<CAmount>(nAmount - nPayFee, 0);
569567
}
570568

571569
// actually update labels

0 commit comments

Comments
 (0)