This commit is contained in:
nora 2023-12-02 20:11:18 +01:00
parent 2cfee8a448
commit 30af4cb9d1
2 changed files with 2 additions and 1 deletions

View file

@ -17,6 +17,7 @@ pub unsafe fn part2(input: &str) {
// o n e X X X X X
// in the integer bytes:
// X X X X X e n o
// this out of bounds read is UB under SB, but fine under models that don't do provenance narrowing with slices. i dont care enough to fix it.
let block = bytes.as_ptr().add(i).cast::<u64>().read_unaligned().to_le();
let one = (block & ((1 << (8 * 1)) - 1)) as u8;

View file

@ -9,7 +9,7 @@ fn main() {
let mut input = std::hint::black_box(include_str!("../input.txt")).to_owned();
input.reserve(5);
input.reserve(10); // enough to read u64
unsafe {
input
.as_mut_vec()