]> git.kaiwu.me - klib.git/commitdiff
bugfix: 2nd best score not set
authorHeng Li <lh3@me.com>
Tue, 12 Feb 2013 22:37:14 +0000 (17:37 -0500)
committerHeng Li <lh3@me.com>
Tue, 12 Feb 2013 22:37:14 +0000 (17:37 -0500)
because I was comparing (uint32_t)-1 with a positive integer...

ksw.c

diff --git a/ksw.c b/ksw.c
index 4599c6b2f8ba5bf071e578a1dc689fc7851d8067..8d741a6ab6338bc8cf061aa12b32975671a701b5 100644 (file)
--- a/ksw.c
+++ b/ksw.c
@@ -211,7 +211,7 @@ end_loop16:
                        low = te - i; high = te + i;
                        for (i = 0; i < n_b; ++i) {
                                int e = (int32_t)b[i];
-                               if ((e < low || e > high) && b[i]>>32 > (uint32_t)r.score2)
+                               if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
                                        r.score2 = b[i]>>32, r.te2 = e;
                        }
                }
@@ -311,7 +311,7 @@ end_loop8:
                        low = te - i; high = te + i;
                        for (i = 0; i < n_b; ++i) {
                                int e = (int32_t)b[i];
-                               if ((e < low || e > high) && b[i]>>32 > (uint32_t)r.score2)
+                               if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
                                        r.score2 = b[i]>>32, r.te2 = e;
                        }
                }
@@ -587,7 +587,7 @@ int main(int argc, char *argv[])
                return 1;
        }
        if (minsc > 0xffff) minsc = 0xffff;
-       if (minsc > 0) xtra |= KSW_XSUBO | minsc;
+       xtra |= KSW_XSUBO | minsc;
        // initialize scoring matrix
        for (i = k = 0; i < 4; ++i) {
                for (j = 0; j < 4; ++j)