Commit 539cf6a5 authored by Matthieu Dorier's avatar Matthieu Dorier

corrected bug in covermap when requested segment does not overlap with covermap

parent 71a81515
...@@ -19,10 +19,14 @@ class covermap { ...@@ -19,10 +19,14 @@ class covermap {
std::map<T,T> m_segments; std::map<T,T> m_segments;
static bool intersects(const T& start1, const T& end1, const T& start2, const T& end2) { static bool intersects(const T& start1, const T& end1, const T& start2, const T& end2) {
if((start1 == end1) || (start2 == end2))
return false;
if(start1 == start2)
return true;
if(start1 < start2) { if(start1 < start2) {
return start2 <= end1; return start2 < end1;
} else { } else {
return start1 <= end2; return start1 < end2;
} }
} }
...@@ -43,6 +47,8 @@ class covermap { ...@@ -43,6 +47,8 @@ class covermap {
// make start and end match the bounds // make start and end match the bounds
if(start < m_start) start = m_start; if(start < m_start) start = m_start;
if(end > m_end) end = m_end; if(end > m_end) end = m_end;
if(start >= m_end) return std::list<segment>();
if(end <= m_start) return std::list<segment>();
if(end-start == 0) return std::list<segment>(); if(end-start == 0) return std::list<segment>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment