Commit 5b0fbd9c by Eric Coissac

Correction of the is_d0_or_d1

parent 81b263d0
......@@ -73,6 +73,8 @@ static int32_t is_d0_or_d1(const char *seq1, const char* seq2, size_t length1, s
int32_t code;
int32_t pos1, pos2, pos;
// First case length difference > 1
if (ABS((int32_t)length1 - (int32_t)length2) > 1)
return 0;
......@@ -81,6 +83,9 @@ static int32_t is_d0_or_d1(const char *seq1, const char* seq2, size_t length1, s
e1 = seq1 + length1;
e2 = seq2 + length2;
// Scans the sequences from their beginings as long as they are identical
while(*b1 == *b2 && (*b1 != 0 && *b2 != 0)) {
b1++;
b2++;
......@@ -88,12 +93,16 @@ static int32_t is_d0_or_d1(const char *seq1, const char* seq2, size_t length1, s
if ((*b1 == 0) && (*b2 == 0)) return 256;
// Scans the sequences from their ends as long as they are identical
while(*e1 == *e2 && (e1 > seq1 || e2 > seq2)) {
e1--;
e2--;
}
if ((e1 > b1) && (e2 > b2))
if ((length1 == length2 && (e1 > b1 || e2 > b2)) |
(length1 > length2 && e1 > b1) ||
(length1 < length2 && e2 > b2))
return 0;
pos1 = e1 - seq1;
......
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