1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

fixup! refactor: tr_completion (#2220)

fix: incorrect calculation in amountDone
This commit is contained in:
Charles Kerr 2021-11-28 22:11:30 -06:00
parent 35fe175f2a
commit 9516e8a923

View file

@ -92,7 +92,7 @@ void tr_completion::amountDone(float* tab, size_t n_tabs) const
auto const blocks_per_tab = std::size(blocks_) / n_tabs;
for (size_t i = 0; i < n_tabs; ++i)
{
auto const begin = i * n_tabs;
auto const begin = i * blocks_per_tab;
auto const end = std::min(begin + blocks_per_tab, std::size(blocks_));
auto const numerator = blocks_.count(begin, end);
tab[i] = (double)numerator / (end - begin);