Skip to content

Commit 5727513

Browse files
committed
fix: initialize move using a invoked lambda
1 parent c5a4828 commit 5727513

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/matcher.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ std::vector<size_t> computeMatch(const CandidateString &subject, const Candidate
6060
Score csc_score = 0;
6161
Score align = 0;
6262
const auto score_diag = score_up;
63-
Direction move;
6463

6564
//Compute a tentative match
6665
if (query_lw[j] == si_lw) {
@@ -76,13 +75,15 @@ std::vector<size_t> computeMatch(const CandidateString &subject, const Candidate
7675
score_up = score_row[j]; // Current score_up is next run score diag
7776
csc_diag = csc_row[j];
7877

79-
// In case of equality, moving UP get us closer to the start of the candidate string.
80-
if (score > score_up) {
81-
move = Direction::LEFT;
82-
} else {
78+
79+
Direction move = [&score_up, &score]() {
80+
// In case of equality, moving UP get us closer to the start of the candidate string.
81+
if (score > score_up) {
82+
return Direction::LEFT;
83+
}
8384
score = score_up;
84-
move = Direction::UP;
85-
}
85+
return Direction::UP;
86+
}();
8687

8788
// Only take alignment if it's the absolute best option.
8889
if (align > score) {

0 commit comments

Comments
 (0)