Checking if two intervals overlap is covered on this page:
http://www.rgrjr.com/emacs/overlap.html
which shows intervals

overlap if

If the intervals are specified by a width

then the overlap test is

and the expression

is equivalent to evaluating

then checking that the result is negative by examining the sign bit.