From e3c6b9de8362325d055d4f220453cf902b9eb1c5 Mon Sep 17 00:00:00 2001 From: guilhermesena1 Date: Fri, 10 Jul 2020 15:38:48 -0700 Subject: [PATCH] minor optimization on alignment score function --- src/abismal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abismal.cpp b/src/abismal.cpp index da615bd..e8bfcfe 100644 --- a/src/abismal.cpp +++ b/src/abismal.cpp @@ -74,6 +74,7 @@ namespace align_scores { static const score_t match = 1, mismatch = -1, indel = -1; + static const vector score_lookup = {match, mismatch}; }; struct ReadLoader { @@ -787,8 +788,7 @@ prep_for_seeds(const Read &pread_seed, Read &pread_even, Read &pread_odd) { static inline score_t mismatch_score(const char q_base, const uint8_t t_base) { - return the_comp(q_base, t_base) ? - align_scores::mismatch : align_scores::match; + return align_scores::score_lookup[the_comp(q_base, t_base)]; } template