pub struct Day05 { /* private fields */ }Expand description
2020 Day 5: Decoding binary numbers.
The key optimization is that F/B and L/R differ only in bit 2. Inverting that bit in
each of the first 8 bytes and gathering the results with one multiply decodes the row and the
first column bit together.
Validation compares each byte against the all-zeros and all-ones passes for its position. lcm(11, 16) = 176 and lcm(12, 16) = 48, so repeating those two lines to fill a block gives templates the compiler can check 16 bytes at a time. This is ~3x faster than parsing bytes one at a time.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Day05
impl RefUnwindSafe for Day05
impl Send for Day05
impl Sync for Day05
impl Unpin for Day05
impl UnsafeUnpin for Day05
impl UnwindSafe for Day05
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more