Skip to content

Commit 5cf1631

Browse files
committed
Fix possible overflow in 2017 day 13
1 parent d37807f commit 5cf1631

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/year2017/src/day13.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ impl Day13 {
4242
// delay % modulus can't equal the value
4343
let mut constraints = BTreeMap::new();
4444
for &(depth, range) in &self.layers {
45-
let modulus = (range as i32 - 1) * 2;
46-
let disallowed_value = (-(depth as i32)).rem_euclid(modulus);
45+
let modulus = (range as i64 - 1) * 2;
46+
let disallowed_value = (-(depth as i64)).rem_euclid(modulus);
4747

4848
constraints
4949
.entry(modulus)

0 commit comments

Comments
 (0)