Skip to content

Commit

Permalink
implement bit_vector::get_word56
Browse files Browse the repository at this point in the history
  • Loading branch information
ot committed Dec 16, 2013
1 parent 15baa54 commit e9620f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bit_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ namespace succinct {
return word;
}

// unsafe and fast version of get_word, it retrieves at least 56 bits
inline uint64_t get_word56(uint64_t pos) const
{
// XXX check endianness?
const char* ptr = reinterpret_cast<const char*>(m_bits.data());
return *(reinterpret_cast<uint64_t const*>(ptr + pos / 8)) >> (pos % 8);
}

inline uint64_t predecessor0(uint64_t pos) const {
assert(pos < m_size);
uint64_t block = pos / 64;
Expand Down

0 comments on commit e9620f3

Please sign in to comment.