Function advent_of_code_2021::day_16::parse_literal[−][src]

fn parse_literal(bits: &mut Vec<bool>) -> (usize, usize)
Expand description

Parse the section of a literal packet representing the number. This will be in chunks of 5 bits, the first being a flag that indicates if parsing should continue after this chunk, the next four being the next four bits in the number. Once the continue flag is 0 indicating this is the final chunk, all four-bit sections should be concatenated and interpreted as the binary representation of a usize. Returns the value and number of bits consumed.