Function aoc::year2019::day08::part1

source ·
pub fn part1(input: &str) -> u32
Expand description

Each layer is 25 * 6 = 150 bytes and there are 100 layers total. It’s faster to count pixels 8 at a time by parsing the bytes as u64 then using bitwise logic and the count_ones intrinsic. The only minor wrinkle is that 8 does not divide 150 evenly so we must handle the last 6 bytes specially.