Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/bit_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ struct bit_vector //

void append_bits(uint64_t bits, uint64_t len) {
// check there are no spurious bits
assert(len <= 64);
assert(len == 64 || (bits >> len) == 0);
if (!len) return;
uint64_t pos_in_word = m_num_bits & 63;
Expand Down
5 changes: 4 additions & 1 deletion include/compact_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <vector>
#include <cmath>
#include <cstring>
#include <iterator>

#include "essentials.hpp"
Expand Down Expand Up @@ -253,7 +254,9 @@ struct compact_vector //
assert(i < size());
uint64_t pos = i * m_width;
const char* ptr = reinterpret_cast<const char*>(m_data.data());
return (*(reinterpret_cast<uint64_t const*>(ptr + (pos >> 3))) >> (pos & 7)) & m_mask;
uint64_t word;
std::memcpy(&word, ptr + (pos >> 3), sizeof(uint64_t));
return (word >> (pos & 7)) & m_mask;
}

uint64_t back() const { return operator[](size() - 1); }
Expand Down