Commit f5983e23 authored by Mikaël Salson's avatar Mikaël Salson

algo/core/kmeraffect.cpp: Fix KmerAffect comparison

We didn't take into account the length (as it was added later). This is now fixed.
parent 13fa3b9a
......@@ -44,13 +44,15 @@ bool operator==(const affect_t &a1, const affect_t &a2) {
|| a1.length == (unsigned char) ~0 || a2.length == (unsigned char)~0 || a1.length == a2.length);
}
bool operator<(const affect_t &a1, const affect_t &a2) {
return a1.c < a2.c;
return a1.c < a2.c
|| (a1.c == a2.c && a1.length < a2.length
&& affect_char(a1) != AFFECT_AMBIGUOUS_CHAR && affect_char(a1) != AFFECT_UNKNOWN_CHAR);
}
bool operator>(const affect_t &a1, const affect_t &a2) {
return a1.c > a2.c;
return ! (a1 <= a2);
}
bool operator<=(const affect_t &a1, const affect_t &a2) {
return ! (a1 > a2);
return (a1 < a2) || (a1 == a2);
}
bool operator>=(const affect_t &a1, const affect_t &a2) {
return ! (a1 < a2);
......
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