# File lib/rubytorrent/package.rb, line 46
  def rint(o)
    ## three cases. either:
    ## a) our left endpoint is within o
    if ((first >= o.first) &&
      ((first < o.last) || (!o.exclude_end? && (first == o.last))))
      if last < o.last
        AwesomeRange.new(first, last, exclude_end?)
      elsif last > o.last
        AwesomeRange.new(first, o.last, o.exclude_end?)
      else # ==
        AwesomeRange.new(first, last, exclude_end? || o.exclude_end?)
      end
    ## b) our right endpoint is within o
    elsif (((last > o.first) || (!exclude_end? && (last == o.first))) && ((last < o.last) || (!o.exclude_end? && (last == o.last))))
      AwesomeRange.new([first, o.first].max, last, exclude_end?)
    ## c) we encompass o
    elsif rss?(o)
      o
    else
      nil
    end
  end