move bwt_invPsi() from bwt.h to bwt.c

This commit is contained in:
Heng Li 2013-02-26 11:57:36 -05:00
parent fd67064207
commit 80e1137a6c
2 changed files with 8 additions and 17 deletions

8
bwt.c
View File

@ -45,6 +45,14 @@ void bwt_gen_cnt_table(bwt_t *bwt)
}
}
static inline bwtint_t bwt_invPsi(const bwt_t *bwt, bwtint_t k) // compute inverse CSA
{
bwtint_t x = k - (k > bwt->primary);
x = bwt_B0(bwt, x);
x = bwt->L2[x] + bwt_occ(bwt, k, x);
return k == bwt->primary? 0 : x;
}
// bwt->bwt and bwt->occ must be precalculated
void bwt_cal_sa(bwt_t *bwt, int intv)
{

17
bwt.h
View File

@ -124,21 +124,4 @@ extern "C" {
}
#endif
// inverse Psi function
#if 0
#define bwt_invPsi(bwt, k) \
(((k) == (bwt)->primary)? 0 : \
((k) < (bwt)->primary)? \
(bwt)->L2[bwt_B0(bwt, k)] + bwt_occ(bwt, k, bwt_B0(bwt, k)) \
: (bwt)->L2[bwt_B0(bwt, (k)-1)] + bwt_occ(bwt, k, bwt_B0(bwt, (k)-1)))
#else
static inline bwtint_t bwt_invPsi(const bwt_t *bwt, bwtint_t k)
{
bwtint_t x = k - (k > bwt->primary);
x = bwt_B0(bwt, x);
x = bwt->L2[x] + bwt_occ(bwt, k, x);
return k == bwt->primary? 0 : x;
}
#endif
#endif