Skip to content

Commit 80b76ac

Browse files
committed
fix: unchain ++i from while
1 parent 03529eb commit 80b76ac

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/matcher.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ std::vector<size_t> computeMatch(const CandidateString &subject, const Candidate
4343
auto trace = std::vector<Direction>(subject_size * query_size, Direction::STOP);
4444
auto pos = -1;
4545

46-
auto i = -1;
47-
while (++i < subject_size) {//foreach char is of subject
46+
int i = 0;// TODO making it size_t breaks the code!
47+
while (i < subject_size) {//foreach char is of subject
48+
assert(0 <= i && i < subject_lw.size());
4849
Score score = 0;
4950
Score score_up = 0;
5051
Score csc_diag = 0;
@@ -102,7 +103,10 @@ std::vector<size_t> computeMatch(const CandidateString &subject, const Candidate
102103
++j;
103104
}
104105
assert(0u <= j && j <= query_size);
106+
107+
++i;
105108
}
109+
assert(0 <= i && i <= subject_lw.size());
106110

107111
// -------------------
108112
// Go back in the trace matrix

0 commit comments

Comments
 (0)