Skip to content

Commit

Permalink
just be boring
Browse files Browse the repository at this point in the history
  • Loading branch information
Icerath committed Dec 16, 2024
1 parent a03dc22 commit bce1aca
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/day15.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(clippy::cast_possible_truncation)]

use std::{
hint::unreachable_unchecked,
simd::{cmp::SimdPartialEq, u8x64, Simd},
};
use std::hint::unreachable_unchecked;

use bstr::ByteSlice;

Expand Down Expand Up @@ -38,18 +35,7 @@ unsafe fn part1_inner(input: &[u8]) -> usize {
}
i += 1;
}
let mut result = 0;
for i in 0..50 {
let line = u8x64::load_or_default(grid.get_unchecked(i * 51..));
let mut mask = line.simd_eq(Simd::splat(b'O')).to_bitmask();
mask &= (1 << 50) - 1;
while mask > 0 {
let j = mask.trailing_zeros() as usize;
result += 100 * i + j;
mask &= mask - 1;
}
}
result
grid.find_iter(b"O").map(|pos| 100 * (pos / 51) + pos % 51).sum()
}

pub fn part2(input: &str) -> usize {
Expand Down

0 comments on commit bce1aca

Please sign in to comment.