Ignore:
Timestamp:
Jun 5, 2008, 8:21:56 PM (14 years ago)
Author:
charles
Message:

bitfield speedups written by denis. Thanks!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.h

    r5979 r6058  
    262262tr_bitfield* tr_bitfieldOr( tr_bitfield*, const tr_bitfield* );
    263263
     264/** A stripped-down version of bitfieldHas to be used
     265    for speed when you're looping quickly.  This version
     266    has none of tr_bitfieldHas()'s safety checks, so you
     267    need to call tr_bitfieldTestFast() first before you
     268    start looping. */
     269#define tr_bitfieldHasFast(bitfield,nth) \
     270    (( bitfield->bits[(nth)>>3u] << ((nth)&7u) & 0x80) != 0 )
     271
     272/** @param high the highest nth bit you're going to access */
     273#define tr_bitfieldTestFast(bitfield,high) \
     274    ((bitfield) && ( (bitfield)->bits ) && ( ((high)>>3u) < (bitfield)->len ))
     275
    264276double tr_getRatio( double numerator, double denominator );
    265277
Note: See TracChangeset for help on using the changeset viewer.