This commit is contained in:
nora 2024-12-03 18:35:11 +01:00
parent f4dbebba6b
commit 314ef2ca61
8 changed files with 132 additions and 3 deletions

View file

@ -307,12 +307,9 @@ fn part2_assume_len(input_str: &str) -> u64 {
}
fn part2_simd(input_str: &str) -> u64 {
const DIGIT_LEN: usize = 5;
let input = input_str.as_bytes();
assert_eq!(input.last(), Some(&b'\n'));
const BIGGEST_ELEMENT: usize = 100_000;
let digit_len = input.iter().position(|b| *b == b' ').unwrap();
if digit_len != 5 {
@ -331,6 +328,9 @@ fn part2_simd(input_str: &str) -> u64 {
}
#[cfg(target_arch = "x86_64")]
pub fn do_sse41(input: &[u8]) -> u64 {
const DIGIT_LEN: usize = 5;
const BIGGEST_ELEMENT: usize = 100_000;
let mut right_map = vec![0_u16; BIGGEST_ELEMENT];
let mut left = Vec::<u32>::with_capacity(input.len());