Skip to content

Commit 3283b38

Browse files
committed
32bit fix
1 parent cedef99 commit 3283b38

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/year2022/day17/day17.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ pub fn solve(data: &str) -> (usize, usize) {
162162
}
163163

164164
if start != 0 && end != 0 {
165-
let remaining_rocks = 1_000_000_000_000 - start;
166-
let cycle_length = end - start;
165+
let remaining_rocks = 1_000_000_000_000 - u64::try_from(start).unwrap();
166+
let cycle_length = u64::try_from(end - start).unwrap();
167167

168-
let q = remaining_rocks / cycle_length;
169-
let r = remaining_rocks % cycle_length;
168+
let q = usize::try_from(remaining_rocks / cycle_length).unwrap();
169+
let r = usize::try_from(remaining_rocks % cycle_length).unwrap();
170170

171171
part2 = heights[start + r] + q * (heights[end] - heights[start]);
172172
}

0 commit comments

Comments
 (0)