Ticket #5159: find_next.patch

File find_next.patch, 695 bytes (added by astukalov@…, 12 years ago)

dynamic_bitset::find_next() optimization

  • boost/dynamic_bitset/dynamic_bitset.hpp

     
    12571257    const size_type blk = block_index(pos);
    12581258    const block_width_type ind = bit_index(pos);
    12591259
    1260     // mask out bits before pos
    1261     const Block fore = m_bits[blk] & ( ~Block(0) << ind );
     1260    // shift bits upto one immediately after current
     1261    const Block fore = m_bits[blk] >> ind;
    12621262
    12631263    return fore?
    1264         blk * bits_per_block + lowest_bit(fore)
     1264        pos + lowest_bit(fore)
    12651265        :
    12661266        m_do_find_from(blk + 1);
    12671267