Torrent: simplify QBitArray usage
There is specific API for counting number of 0-bits Pick-to: 6.5 Task-number: QTBUG-110622 Change-Id: Ifa33862ff7b98a59f362bc52c492e8a037799835 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
6d0c774c51
commit
d3c1445419
@ -1024,13 +1024,7 @@ void TorrentClient::peerWireBytesReceived(qint64 size)
|
||||
|
||||
int TorrentClient::blocksLeftForPiece(const TorrentPiece *piece) const
|
||||
{
|
||||
int blocksLeft = 0;
|
||||
int completedBlocksSize = piece->completedBlocks.size();
|
||||
for (int i = 0; i < completedBlocksSize; ++i) {
|
||||
if (!piece->completedBlocks.testBit(i))
|
||||
++blocksLeft;
|
||||
}
|
||||
return blocksLeft;
|
||||
return piece->completedBlocks.count(false);
|
||||
}
|
||||
|
||||
void TorrentClient::scheduleUploads()
|
||||
|
Loading…
Reference in New Issue
Block a user