runtime/int.c
// We could do a binary search here, but since we coalesce individual singletons into ranges,
// the common case will be 1 or a few ranges, where the overhead of binary search will make
// it lose over linear search.
// XXX We should do a binary search when the number of ranges is not small
// (e.g. > something like 8, I guess)
// We know that r < end (because nRanges > 0)
We could do a binary search here, but since we coalesce individual singletons into ranges,
the common case will be 1 or a few ranges, where the overhead of binary search will make
it lose over linear search.
XXX We should do a binary search when the number of ranges is not small

We know that r < end (because nRanges > 0)
We could do a binary search here but since we coalesce individual singletons into ranges the common case will be 1 or a few ranges where the overhead of binary search will make it lose over linear search . XXX We should do a binary search when the number of ranges is not small We know that r < end ( because nRanges > 0 )
static bool intRangeListContains(const IntRange *r, const IntRange *end, int64_t n) {
    for (;;) {
        if (n <= r->max) {
            if (n >= r->min) {
                return true;
            }
            break;
        }
        if (++r == end) {
            break;
        }
    }
    return false;
}
static bool intRangeListContains ( const IntRange * r , const IntRange * end , int64_t n ) { for ( ; ; ) { if ( n <= r -> max ) { if ( n >= r -> min ) { return true ; } break ; } if ( ++ r == end ) { break ; } } return false ; }
We could do a binary search here, but since we coalesce individual singletons into ranges,
the common case will be 1 or a few ranges, where the overhead of binary search will make
it lose over linear search.
We could do a binary search here but since we coalesce individual singletons into ranges the common case will be 1 or a few ranges where the overhead of binary search will make it lose over linear search .
// Try to do minimum amount of work when there is just one range. // if it's less than r->max then it will be less than p->min for all p > r