87 output = prev_output_;
105 if (reader.remaining() < 4) {
108 std::uint32_t vt_raw = reader.read_bits(4);
109 std::uint8_t Vt =
static_cast<std::uint8_t
>(vt_raw & 0x0FU);
115 if (Vt > 0 && change_count > 0) {
117 int et = reader.read_bit();
125 for (std::size_t word = 0; word < BitVector<N>::NUM_WORDS; ++word) {
126 std::uint32_t xt_word = Xt.
data()[word];
128 for (
int bits_remaining = __builtin_popcount(xt_word); bits_remaining > 0;
132 std::size_t global_pos = (word * 32) +
static_cast<std::size_t
>(clz);
134 if (global_pos < N) {
135 int kt_bit = reader.read_bit();
142 mask_.set_bit_unchecked(global_pos, 0);
143 Xt_.set_bit_unchecked(global_pos, 1);
145 mask_.set_bit_unchecked(global_pos, 1);
152 ct = reader.read_bit();
159 for (std::size_t word = 0; word < BitVector<N>::NUM_WORDS; ++word) {
160 std::uint32_t xt_word = Xt.
data()[word];
162 for (
int bits_remaining = __builtin_popcount(xt_word); bits_remaining > 0;
165 std::size_t global_pos = (word * 32) +
static_cast<std::size_t
>(clz);
166 if (global_pos < N) {
167 mask_.set_bit_unchecked(global_pos, 1);
172 }
else if (Vt == 0 && change_count > 0) {
175 for (std::size_t word = 0; word < BitVector<N>::NUM_WORDS; ++word) {
176 std::uint32_t xt_word = Xt.
data()[word];
178 for (
int bits_remaining = __builtin_popcount(xt_word); bits_remaining > 0;
181 std::size_t global_pos = (word * 32) +
static_cast<std::size_t
>(clz);
182 if (global_pos < N) {
183 int current_val = mask_.get_bit_unchecked(global_pos);
184 mask_.set_bit_unchecked(global_pos, current_val == 0 ? 1 : 0);
192 int dt = reader.read_bit();
207 int ft = reader.read_bit();
227 int current = mask_diff.
get_bit(N - 1);
228 mask_.set_bit(N - 1, current);
231 for (std::size_t i = N - 1; i > 0; --i) {
232 std::size_t pos = i - 1;
233 int hxor_bit = mask_diff.
get_bit(pos);
235 current = hxor_bit ^ current;
236 mask_.set_bit(pos, current);
241 rt = reader.read_bit();
249 std::uint32_t packet_length = 0;
256 for (std::size_t i = 0; i < N; ++i) {
257 int bit = reader.read_bit();
261 output.set_bit(i, bit > 0 ? 1 : 0);
267 if (ct == 1 && Vt > 0) {
269 extraction_mask.
or_of(mask_, Xt_);
272 extraction_mask = mask_;
276 status =
bit_insert(reader, output, extraction_mask);
286 prev_output_ = output;