diff --git a/libtransmission/bitfield.h b/libtransmission/bitfield.h index 64760fcfe..85298b81c 100644 --- a/libtransmission/bitfield.h +++ b/libtransmission/bitfield.h @@ -97,27 +97,6 @@ tr_bitfieldHasNone( const tr_bitfield * b ) return b->bit_count ? ( b->true_count == 0 ) : b->have_none_hint; } -/** A stripped-down version of bitfieldHas to be used - for speed when you're looping quickly. This version - has none of tr_bitfieldHas()'s safety checks, so you - need to call tr_bitfieldTestFast() first before you - start looping. */ -static inline bool -tr_bitfieldHasFast( const tr_bitfield * b, const size_t n ) -{ - if( tr_bitfieldHasAll( b ) ) return true; - if( tr_bitfieldHasNone( b ) ) return false; - return ( b->bits[n>>3u] << ( n & 7u ) & 0x80 ) != 0; -} - -/** @param high the highest nth bit you're going to access */ -static inline bool -tr_bitfieldTestFast( const tr_bitfield * b, const size_t high ) -{ - return ( b != NULL ) - && ( high < b->bit_count ); -} - static inline bool tr_bitfieldHas( const tr_bitfield * b, size_t n ) { diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 8044f532c..eb55315c4 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1244,8 +1244,6 @@ tr_incrReplicationFromBitfield( Torrent * t, const tr_bitfield * b ) const size_t n = t->tor->info.pieceCount; assert( replicationExists( t ) ); - assert( n == t->pieceReplicationSize ); - assert( tr_bitfieldTestFast( b, n-1 ) ); for( i=0; i= MINUTES_PER_WEEK ) /* leap minutes? */ minute_of_the_week = MINUTES_PER_WEEK - 1; - e = tr_bitfieldHasFast( &t->minutes, minute_of_the_week ); + e = tr_bitfieldHas( &t->minutes, minute_of_the_week ); if( enabled != NULL ) *enabled = e; @@ -1343,7 +1343,7 @@ testTurtleTime( const struct tr_turtle_info * t, { const size_t prev = minute_of_the_week > 0 ? minute_of_the_week - 1 : MINUTES_PER_WEEK - 1; - *changed = e != tr_bitfieldHasFast( &t->minutes, prev ); + *changed = e != tr_bitfieldHas( &t->minutes, prev ); } }