Changeset 9562 for trunk/libtransmission/bitset.h
- Timestamp:
- Nov 25, 2009, 4:12:55 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bitset.h
r9558 r9562 17 17 #ifndef TR_BITSET_H 18 18 #define TR_BITSET_H 1 19 20 #include <assert.h>21 19 22 20 #include "transmission.h" … … 53 51 tr_bitfieldDestruct( &b->bitfield ); 54 52 tr_bitfieldConstruct( &b->bitfield, size ); 55 assert( b->bitfield.byteCount >= tmp->byteCount ); 56 memcpy( &b->bitfield.bits, tmp->bits, tmp->byteCount ); 53 memcpy( b->bitfield.bits, tmp->bits, tmp->byteCount ); 57 54 58 55 tr_bitfieldFree( tmp ); … … 65 62 if( b->haveAll ) return TRUE; 66 63 if( b->haveNone ) return FALSE; 64 if( nth >= b->bitfield.bitCount ) return FALSE; 67 65 return tr_bitfieldHasFast( &b->bitfield, nth ); 68 66 } … … 73 71 if( b->haveAll ) return TRUE; 74 72 if( b->haveNone ) return FALSE; 73 if( nth >= b->bitfield.bitCount ) return FALSE; 75 74 return tr_bitfieldHas( &b->bitfield, nth ); 76 75 } … … 124 123 if( !b->haveAll ) { 125 124 b->haveNone = 0; 126 tr_bitsetReserve( b, i );125 tr_bitsetReserve( b, i+1 ); 127 126 ret = tr_bitfieldAdd( &b->bitfield, i ); 128 127 }
Note: See TracChangeset
for help on using the changeset viewer.