Skip to content
Open

d19 #17

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions src/day19.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,35 @@ unsafe fn inner1(s: &[u8]) -> u32 {
};
}

loop {
let mut hash = hash!(*ptr);
let mut curr = 0;
loop {
ptr = ptr.add(1);
let next = trie.add(curr).cast::<u16>().add(hash as usize);
if *next == 0 {
len += 1;
*next = len;
*trie.add(len as usize) = [0; 6];
({
#[inline(never)]
|| loop {
let mut hash = hash!(*ptr);
let mut curr = 0;
loop {
ptr = ptr.add(1);
let next = trie.add(curr).cast::<u16>().add(hash as usize);
if *next == 0 {
len += 1;
*next = len;
*trie.add(len as usize) = [0; 6];
}

hash = hash!(*ptr);
curr = *next as usize;
if (hash as i32) < 0 {
break;
}
}

hash = hash!(*ptr);
curr = *next as usize;
if (hash as i32) < 0 {
ptr = ptr.add(2);
assert!(*ptr > 64);
*trie.add(curr).cast::<u16>().add(2) = 1;
if is_lf!(hash) {
break;
}
}

ptr = ptr.add(2);
assert!(*ptr > 64);
*trie.add(curr).cast::<u16>().add(2) = 1;
if is_lf!(hash) {
break;
}
}
})();

let mut total = 0;

Expand Down
Loading