Skip to content

Commit

Permalink
Merge #9553: Use z = std::max(x - y, 0) instead of z = x - y; if (z <…
Browse files Browse the repository at this point in the history
… 0) z = 0;

a47da4b Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; (practicalswift)
  • Loading branch information
laanwj committed Feb 15, 2017
2 parents a441db0 + a47da4b commit 4c69d68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ bool CAddrInfo::IsTerrible(int64_t nNow) const
double CAddrInfo::GetChance(int64_t nNow) const
{
double fChance = 1.0;

int64_t nSinceLastTry = nNow - nLastTry;

if (nSinceLastTry < 0)
nSinceLastTry = 0;
int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0);

// deprioritize very recent attempts away
if (nSinceLastTry < 60 * 10)
Expand Down
4 changes: 1 addition & 3 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}

// after fee
nAfterFee = nAmount - nPayFee;
if (nAfterFee < 0)
nAfterFee = 0;
nAfterFee = std::max<CAmount>(nAmount - nPayFee, 0);
}

// actually update labels
Expand Down

0 comments on commit 4c69d68

Please sign in to comment.