Ignore:
Timestamp:
Jun 7, 2008, 2:41:31 PM (14 years ago)
Author:
charles
Message:

add first draft of tr_bitfieldFindTrue() courtesy of erdgeist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r6071 r6072  
    181181
    182182int
     183tr_cpBlockFindComplete( const tr_completion * cp,
     184                        size_t                startPos,
     185                        size_t              * foundPos )
     186{
     187    return tr_bitfieldFindTrue( cp->blockBitfield, startPos, foundPos );
     188}
     189
     190int
    183191tr_cpBlockIsComplete( const tr_completion * cp, tr_block_index_t block )
    184192{
     
    233241
    234242    tr_cpReset( cp );
    235     for( i=0; i < cp->tor->blockCount; ++i )
    236         if( tr_bitfieldHas( bitfield, i ) )
    237             tr_cpBlockAdd( cp, i );
     243    i = 0;
     244    while( tr_bitfieldFindTrue( bitfield, i, &i ) )
     245        tr_cpBlockAdd( cp, i++ );
    238246
    239247    return 0;
Note: See TracChangeset for help on using the changeset viewer.