Skip to content

Commit

Permalink
move bwt_invPsi() from bwt.h to bwt.c
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Feb 26, 2013
1 parent fd67064 commit 80e1137
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
8 changes: 8 additions & 0 deletions bwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
17 changes: 0 additions & 17 deletions bwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 80e1137

Please sign in to comment.