MCPcopy Create free account
hub / github.com/comaps/comaps / get_bits

Method get_bits

3party/succinct/bit_vector.hpp:265–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263 }
264
265 inline uint64_t get_bits(uint64_t pos, uint64_t len) const {
266 assert(pos + len <= size());
267 if (!len) {
268 return 0;
269 }
270 uint64_t block = pos / 64;
271 uint64_t shift = pos % 64;
272 uint64_t mask = -(len == 64) | ((1ULL << len) - 1);
273 if (shift + len <= 64) {
274 return m_bits[block] >> shift & mask;
275 } else {
276 return (m_bits[block] >> shift) | (m_bits[block + 1] << (64 - shift) & mask);
277 }
278 }
279
280 // same as get_bits(pos, 64) but it can extend further size(), padding with zeros
281 inline uint64_t get_word(uint64_t pos) const

Callers 10

retrieve_valueMethod · 0.80
BOOST_FOREACHFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
retrieve_valueMethod · 0.80
operator[]Method · 0.80
selectMethod · 0.80
rankMethod · 0.80
deltaMethod · 0.80
select_rangeMethod · 0.80
operator[]Method · 0.80

Calls 1

sizeFunction · 0.85

Tested by 2

BOOST_FOREACHFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64