Skip to content

Commit 732f947

Browse files
committed
Way smaller stack
1 parent 8c4b7dd commit 732f947

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/day24.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ impl Gate {
100100
}
101101
}
102102

103+
#[inline(always)]
103104
pub fn part1_inner(s: &[u8]) -> u64 {
104105
let mut gates_map = [0u16; 26 * 26 * 26];
105106

@@ -113,7 +114,7 @@ pub fn part1_inner(s: &[u8]) -> u64 {
113114
)
114115
.unwrap();
115116

116-
let mut stack = heapless::Vec::<(u16, bool), 2048>::new();
117+
let mut stack = heapless::Vec::<(u16, bool), 128>::new();
117118

118119
let mut i = CSTART;
119120
unsafe {
@@ -273,6 +274,7 @@ pub fn part2(s: &str) -> &'static str {
273274

274275
const ZSTART: u16 = 26 * 26 * 26;
275276

277+
#[inline(always)]
276278
pub fn part2_inner(s: &[u8]) -> &'static str {
277279
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
278280
enum State {

0 commit comments

Comments
 (0)