From: Charles Kerr Date: Fri, 30 May 2008 15:40:46 +0000 (+0000) Subject: minor speedups in tr_torrentStat() and in bitfield manipulation X-Git-Tag: 1.22~201 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0705eaa1c08e8807372793def7dbedc4d664f52b;p=transmission minor speedups in tr_torrentStat() and in bitfield manipulation --- diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index c57cf5f1f..12871d5ed 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -741,7 +741,9 @@ tr_torrentStat( tr_torrent * tor ) s->haveUnchecked = tr_cpHaveTotal( tor->completion ) - s->haveValid; - { + if( !s->leftUntilDone ) + s->desiredAvailable = 0; + else { tr_piece_index_t i; tr_bitfield * peerPieces = tr_peerMgrGetAvailable( tor->handle->peerMgr, tor->info.hash ); diff --git a/libtransmission/utils.c b/libtransmission/utils.c index fecd2be36..559fef204 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -740,7 +740,7 @@ tr_bitfieldAdd( tr_bitfield * bitfield, size_t nth ) return -1; bitfield->bits[i] |= ands[nth&7u]; - assert( tr_bitfieldHas( bitfield, nth ) ); + /*assert( tr_bitfieldHas( bitfield, nth ) );*/ return 0; } @@ -771,7 +771,7 @@ tr_bitfieldRem( tr_bitfield * bitfield, return -1; bitfield->bits[i] &= rems[nth&7u]; - assert( !tr_bitfieldHas( bitfield, nth ) ); + /*assert( !tr_bitfieldHas( bitfield, nth ) );*/ return 0; }