2021 day16/rust: fix assertion in bit-slicing implementation

This commit is contained in:
Xiretza 2022-01-23 19:15:43 +01:00
parent e3c6a8f29c
commit 8e29118629

View file

@ -7,7 +7,7 @@ use std::{
use nom::{
bits::complete as bits,
multi::{many0, many_m_n},
multi::{many0, many_m_n}, Offset,
};
use nom::{combinator::map, sequence::pair};
use parsers::fold_till;
@ -99,7 +99,8 @@ impl PacketType {
let (subpackets_end, subpackets) = many0(Packet::parse)(subpackets_input)?;
let new_input = (&i.0[new_byte_offset..], new_bit_offset);
assert_eq!(subpackets_end, new_input);
assert_eq!(i.0.offset(subpackets_end.0), i.0.offset(new_input.0));
assert_eq!(subpackets_end.1, new_input.1);
Ok((
new_input,