INNER CODE UNIT · C
cap
lh3/miniprot · align.c:206
cap = cigar->n + sizeof(mp_extra_t) / 4;
r->p = Kcalloc(0, mp_extra_t, cap); // allocate globally, not from km
r->p->dp_score = score;
r->p->n_cigar = r->p->m_cigar = cigar->n;
memcpy(r->p->cigar, cigar->c, cigar->n * sizeof(uint32_t));
kfree(km, cigar->c);
}
static int32_t mp_extra_stop(const mp_reg1_t *r, const uint8_t *nt, int64_t as, int64_t ae)
{
int64_t j;
for (j = r->ve; j + 2 < ae; j += 3) {
int32_t i = j - as;
uint8_t codon = nt[i]<<4 | nt[i+1]<<2 | nt[i+2];
uint8_t aa = nt[i] > 3 || nt[i+1] > 3 || nt[i+2] > 3? ns_tab_aa20['X'] : ns_tab_codon[codon];
if (aa == 20) return j - r->ve;
}
return -1;