22 inline bool operator[](
size_t index) {
return get(index); }
28 int offset = index /
sizeof(
uint64_t);
30 if (offset < vector.size()) {
33 result = (value >>
bit) & 1U;
38 void set(
int64_t index,
bool value) {
41 max_idx = max(max_idx, index + 1);
42 int offset = index /
sizeof(
uint64_t);
44 while (offset >= vector.size()) {
48 if (((vector[offset] >>
bit) & 1U) != value) {
52 vector[offset] |= 1UL <<
bit;
55 vector[offset] &= ~(1UL <<
bit);
67 vector.shrink_to_fit();
70 int size() {
return max_idx; }
74 void *ref =
nullptr) {
80 void resize(
int size) {
84 for (
int j=0;
j<max_idx;
j++){
93 for (
int j = 0;
j < max_idx - n;
j++) {
99 template <
typename T>
T toInt(
int n) {
101 for (
int j = 0;
j <
sizeof(
T) * 8;
j++) {
104 result ^= (-x ^ result) & (1UL <<
j);