From 0705eaa1c08e8807372793def7dbedc4d664f52b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 30 May 2008 15:40:46 +0000 Subject: [PATCH] minor speedups in tr_torrentStat() and in bitfield manipulation --- libtransmission/torrent.c | 4 +++- libtransmission/utils.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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; }