fix chain spliting bug

This commit is contained in:
chhylp123
2023-04-14 16:43:41 -04:00
parent 84e642d20d
commit 0efcc14499
2 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include <pthread.h>
#include <stdint.h>
#define HA_VERSION "0.19.4-r583"
#define HA_VERSION "0.19.4-r584"
#define VERBOSE 0
+14 -8
View File
@@ -7365,7 +7365,7 @@ void rebuid_idx(ul_resolve_t *uidx)
init_ul_str_idx_t(uidx);
}
void shrink_1b(ma_ug_t *ug, uc_block_t *z, uint32_t is_forward)
void shrink_1b(ma_ug_t *ug, uc_block_t *z, uc_block_t *lim, uint32_t is_forward)
{
if(z->ts != 0 || z->te != ug->g->seq[z->hid].len) return;
uc_block_t bc = *z;
@@ -7377,12 +7377,14 @@ void shrink_1b(ma_ug_t *ug, uc_block_t *z, uint32_t is_forward)
} else {
z->te -= 1; z->qs += off;
}
if((lim) && (!((z->qs <= lim->qs) && (z->qe <= lim->qe)))) *z = bc;
} else {
if((!z->rev)) {
z->te -= 1; z->qe -= off;
} else {
z->ts += 1; z->qe -= off;
}
if((lim) && (!((z->qs >= lim->qs) && (z->qe >= lim->qe)))) *z = bc;
}
if((ugl_cover_check(bc.ts, bc.te, &(ug->u.a[bc.hid]))) &&
(!ugl_cover_check(z->ts, z->te, &(ug->u.a[z->hid])))) {
@@ -7436,7 +7438,7 @@ void renew_ul_vec_t(ul_vec_t *x, ma_ug_t *ug)
void shrink_ul0(all_ul_t *uls, ul_str_t *str, uint64_t id, integer_t *buf, ma_ug_t *ug)
{
uint32_t k, c_k, p_k, cv, pv, bl, i; uc_block_t *xi; buf->u.n = 0; nid_t *np = NULL;
uint32_t k, c_k, p_k, cv, pv, bl, i; uc_block_t *xi, *yi; buf->u.n = 0; nid_t *np = NULL;
asg_arc_t *av; uint32_t nv, s, e, m, d, mm, is_conn; uint64_t *z; ul_vec_t *x;
if(str->cn < 2) return;
for (k = 0, bl = 0, c_k = p_k = pv = (uint32_t)-1; k < str->cn; k++) {
@@ -7464,6 +7466,11 @@ void shrink_ul0(all_ul_t *uls, ul_str_t *str, uint64_t id, integer_t *buf, ma_ug
is_conn = 1;
}
}
if(is_conn) {
is_conn = 0; assert(k);
yi = &(uls->a[id].bb.a[str->a[k-1]>>32]);
if((xi->qs >= yi->qs) && (xi->qe >= yi->qe)) is_conn = 1;
}
if(is_conn) {
bl++;
} else {
@@ -7514,10 +7521,9 @@ void shrink_ul0(all_ul_t *uls, ul_str_t *str, uint64_t id, integer_t *buf, ma_ug
x->bb.n = m;
assert(x->bb.n > 1);
shrink_1b(ug, &(x->bb.a[0]), 1);
shrink_1b(ug, &(x->bb.a[x->bb.n-1]), 0);
shrink_1b(ug, &(x->bb.a[0]), ((x->bb.n>=2)?&(x->bb.a[1]):(NULL)), 1);
shrink_1b(ug, &(x->bb.a[x->bb.n-1]), ((x->bb.n>=2)?&(x->bb.a[x->bb.n-2]):(NULL)), 0);
d = x->bb.a[0].qs;
for (k = 0; k < x->bb.n; k++) {
x->bb.a[k].qs -= d; x->bb.a[k].qe -= d;
@@ -7546,8 +7552,8 @@ void shrink_ul0(all_ul_t *uls, ul_str_t *str, uint64_t id, integer_t *buf, ma_ug
}
x->bb.n = m;
assert(x->bb.n > 1);
shrink_1b(ug, &(x->bb.a[0]), 1);
shrink_1b(ug, &(x->bb.a[x->bb.n-1]), 0);
shrink_1b(ug, &(x->bb.a[0]), ((x->bb.n>=2)?&(x->bb.a[1]):(NULL)), 1);
shrink_1b(ug, &(x->bb.a[x->bb.n-1]), ((x->bb.n>=2)?&(x->bb.a[x->bb.n-2]):(NULL)), 0);
d = x->bb.a[0].qs;
for (k = 0; k < x->bb.n; k++) {
x->bb.a[k].qs -= d; x->bb.a[k].qe -= d;