Skip to content

Commit

Permalink
ported bug fixes from vgteam/sdsl-lite
Browse files Browse the repository at this point in the history
  • Loading branch information
karasikov committed Mar 10, 2021
1 parent ce1347f commit 102ec97
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions include/sdsl/sd_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,11 @@ class select_0_support_sd
size_type j = m_pointer[(i-1)/(64*bs)]*64;// index into m_high
size_type rank1 = m_rank1[(i-1)/(64*bs)]; // rank_1(j*bs*64) in B
size_type pos = 0;
size_type rank0 = 0;

if (rank1 > 0 and (m_v->high[j-1])&1) {
pos = (j-rank1)*bs + m_v->low[rank1-1]; // starting position of current block
rank0 = pos+1-rank1;
} else {
pos = (j-rank1)*bs;// starting position of current block
rank0 = pos-rank1;
}
uint64_t w = m_v->high.get_int(j, 64);
do {
Expand Down
2 changes: 1 addition & 1 deletion include/sdsl/select_support_mcl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ void select_support_mcl<t_b,t_pat_len>::init_slow(const bit_vector* v)
}
}

// TODO: find bug, detected by valgrind
template<uint8_t t_b, uint8_t t_pat_len>
void select_support_mcl<t_b,t_pat_len>::init_fast(const bit_vector* v)
{
Expand Down Expand Up @@ -279,6 +278,7 @@ void select_support_mcl<t_b,t_pat_len>::init_fast(const bit_vector* v)
size_type last_k64 = 1, sb_cnt=0;
for (size_type i=0, cnt_old=0, cnt_new=0, last_k64_sum=1; i < v->capacity(); i+=64, ++data) {
cnt_new += select_support_trait<t_b, t_pat_len>::args_in_the_word(*data, carry_new);
cnt_new = std::min(cnt_new, m_arg_cnt);
if (cnt_new >= last_k64_sum) {
arg_position[(last_k64-1)/64] = i + select_support_trait<t_b, t_pat_len>::ith_arg_pos_in_the_word(*data, last_k64_sum - cnt_old, carry_new);
last_k64 += 64;
Expand Down
2 changes: 1 addition & 1 deletion include/sdsl/suffix_array_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ class bwt_of_csa_wt
*/
size_type select(size_type i, const char_type c)const
{
return m_csa.select(i, c);
return m_csa.select_bwt(i, c);
}


Expand Down

0 comments on commit 102ec97

Please sign in to comment.