Skip to content

Commit

Permalink
connect end to start diag
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Feb 27, 2024
1 parent 38f3fc6 commit 36bc232
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/nam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ void merge_nearby_nams(std::vector<Nam>& nams) {
}
// by diagonal
// TODO make branchless
return (a.diagonal() < b.diagonal()) || ((a.diagonal() == b.diagonal()) && (a.ref_start < b.ref_start));
return (a.start_diagonal() < b.start_diagonal()) || ((a.start_diagonal() == b.start_diagonal()) && (a.ref_start < b.ref_start));
});
if (nams.empty()) {
return;
}

size_t j = 0;
for (size_t i = 1; i < nams.size(); i++) {
if (nams[j].ref_id == nams[i].ref_id && nams[j].diagonal() == nams[i].diagonal() && nams[j].is_rc == nams[i].is_rc
&& nams[j].query_end + 100 <= nams[i].query_start
if (nams[j].ref_id == nams[i].ref_id && nams[j].end_diagonal() == nams[i].start_diagonal() && nams[j].is_rc == nams[i].is_rc
&& nams[j].query_end + 10 <= nams[i].query_start
) {
assert(nams[j].is_rc == nams[i].is_rc);
// merge // TODO turn into method
Expand Down
6 changes: 5 additions & 1 deletion src/nam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ struct Nam {
return std::max(0, ref_start - query_start);
}

int diagonal() const {
int start_diagonal() const {
return ref_start - query_start;
}

int end_diagonal() const {
return ref_end - query_end;
}
};

void merge_nearby_nams(std::vector<Nam>& nams);
Expand Down

0 comments on commit 36bc232

Please sign in to comment.