예제 #1
0
static void merge_close_ranges_and_create_filter( struct reference_region * self, uint64_t merge_diff )
{
    uint32_t n = VectorLength( &self->ranges );
    uint32_t i = 0;
    struct reference_range * a = NULL;
    while ( i < n )
    {
        struct reference_range * b = VectorGet ( &self->ranges, i );
        bool remove = false;
        if ( a != NULL )
        {
            /* get the distance between a and b */
            uint64_t d = range_distance( a, b );
            remove = ( d < merge_diff );
            if ( remove )
            {
                struct reference_range * r;

                /* add the gap to the skip-vector of a */
                struct skip_range * sr = make_skip_range( a->end + 1, b->start - 1 );
                VectorAppend ( &( a->skip ), NULL, sr );

                /* expand a to merge with b */
                a->end = b->end;

                /* remove b */
                VectorRemove ( &self->ranges, i, (void**)&r );
                free( r );
                n--;
            }
        }
        if ( !remove )
        {
            a = b;
            ++i;
        }
    }
}
예제 #2
0
파일: distance.hpp 프로젝트: jhellrung/sake
inline typename ::sake::range_difference< R const >::type
adl(R const & r)
{ return range_distance(r); }