Skip to content

Commit

Permalink
fixed inconsistency introduced in cbcbbcb
Browse files Browse the repository at this point in the history
  • Loading branch information
karasikov committed Dec 14, 2019
1 parent fb4f289 commit 02d138d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/sdsl/construct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void append_zero_symbol(int_vector& text)


template<class t_index>
void construct(t_index& idx, const std::string &file, uint8_t num_bytes=0)
void construct(t_index& idx, const std::string& file, uint8_t num_bytes=0)
{
tMSS file_map;
cache_config config;
Expand All @@ -65,7 +65,7 @@ void construct(t_index& idx, const std::string &file, uint8_t num_bytes=0)
}

template<class t_index, class t_data>
void construct_im(t_index& idx, const t_data &data, uint8_t num_bytes=0)
void construct_im(t_index& idx, const t_data& data, uint8_t num_bytes=0)
{
std::string tmp_file = ram_file_name(util::to_string(util::pid())+"_"+util::to_string(util::id()));
store_to_file(data, tmp_file);
Expand Down Expand Up @@ -98,7 +98,7 @@ void construct(t_index& idx, const std::string& file, cache_config& config, uint
auto event = memory_monitor::event("construct wavelet tree");
if ((t_index::alphabet_category::WIDTH==8 and num_bytes <= 1)
or (t_index::alphabet_category::WIDTH==0 and num_bytes != 'd')) {
int_vector_buffer<> text_buf(file, std::ios::in, 1024*1024, num_bytes*8, (bool)num_bytes);
int_vector_buffer<t_index::alphabet_category::WIDTH> text_buf(file, std::ios::in, 1024*1024, num_bytes*8, (bool)num_bytes);
t_index tmp(text_buf, text_buf.size());
idx.swap(tmp);
} else {
Expand All @@ -109,7 +109,7 @@ void construct(t_index& idx, const std::string& file, cache_config& config, uint
store_to_file(text, tmp_file_name);
util::clear(text);
{
int_vector_buffer<> text_buf(tmp_file_name);
int_vector_buffer<t_index::alphabet_category::WIDTH> text_buf(tmp_file_name);
t_index tmp(text_buf, text_buf.size());
idx.swap(tmp);
}
Expand Down
2 changes: 2 additions & 0 deletions include/sdsl/int_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ class int_vector
{
uint64_t written_bytes = write_member(size, out);
if (0 == t_width) {
// FYI: int_vector_buffer<> can't read from int_vector_buffer<width>
// fix this by always writing the width?
written_bytes += write_member(int_width, out);
}
return written_bytes;
Expand Down

0 comments on commit 02d138d

Please sign in to comment.