285,287c285,291
< if (!interleaved()) {
< return _start <= r._end && _end >= r._start;
< }
---
> if (_start > r._end || _end < r._start)
> // start with the simple case of no overlap at all,
> // applicable even if we have interleaved ranges
> return false;
> else if (!interleaved() && !r.interleaved())
> // if neither range is interleaved, we are done
> return true;
289,290c293
< // the current range is interleaved, split the check up in
< // three cases
---
> // now it gets complicated, focus on the cases we care about
295,297d297
< else if (!r.interleaved())
< // be conservative and ignore the interleaving
< return _start <= r._end && _end >= r._start;
303,304c303,304
< panic("Cannot test intersection of interleaved range %s\n",
< to_string());
---
> panic("Cannot test intersection of %s and %s\n",
> to_string(), r.to_string());