From 1199519970022ab8d3460a702d9c6d618bc06169 Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:05:27 +0100 Subject: [PATCH] cleanup --- 2024/Cargo.lock | 25 ------------------------- 2024/day08/Cargo.toml | 1 - 2024/day08/src/lib.rs | 11 ++--------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/2024/Cargo.lock b/2024/Cargo.lock index 2300be3..3515154 100644 --- a/2024/Cargo.lock +++ b/2024/Cargo.lock @@ -51,12 +51,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - [[package]] name = "bitflags" version = "2.6.0" @@ -192,7 +186,6 @@ dependencies = [ "divan", "helper", "nom", - "num-integer", "smallvec", ] @@ -280,24 +273,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - [[package]] name = "proc-macro2" version = "1.0.92" diff --git a/2024/day08/Cargo.toml b/2024/day08/Cargo.toml index 532c347..551b23f 100644 --- a/2024/day08/Cargo.toml +++ b/2024/day08/Cargo.toml @@ -10,7 +10,6 @@ nom.workspace = true helper.workspace = true divan.workspace = true smallvec = "1.13.2" -num-integer = "0.1.46" [[bench]] name = "benches" diff --git a/2024/day08/src/lib.rs b/2024/day08/src/lib.rs index 35be4b1..acb4127 100644 --- a/2024/day08/src/lib.rs +++ b/2024/day08/src/lib.rs @@ -344,15 +344,8 @@ fn part2(input: &str) -> u64 { continue; } - let mut diff = (a.0 - b.0, a.1 - b.1); - - loop { - let gcd = num_integer::gcd(diff.0, diff.1); - if gcd == 1 { - break; - } - diff = (diff.0 / gcd, diff.1 / gcd); - } + // diff is always reduced already, no reduction is needed. + let diff = (a.0 - b.0, a.1 - b.1); let mut antinode = a; while (0..(width as i64)).contains(&antinode.0)