Skip to content

Commit

Permalink
Made code worse
Browse files Browse the repository at this point in the history
On purpose, in order to check why CI is failing
  • Loading branch information
1Git2Clone committed Nov 17, 2024
1 parent ce10d34 commit 604dcae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/utils/gcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ where
/// NOTE: Exists for the internal LCM implementation.
#[deprecated(note = "use crate::utils::gcd::Gcd::gcd() instead.")]
#[must_use]
fn __gcd_no_zero_check(mut self, mut other: Self) -> Self {
fn __gcd_no_zero_check(mut self, mut other: Self) -> u32 {
let k = {
let i = self.trailing_zeros();
let j = other.trailing_zeros();
i.min(j) as usize
i.min(j)
};

while !other.is_zero() {
Expand All @@ -27,13 +27,13 @@ where
other >>= other.trailing_zeros();
}

self << k
(self.to_u32().unwrap()) << k
}
fn gcd(self, other: Self) -> Self {
fn gcd(self, other: Self) -> u32 {
if self.is_zero() {
return self;
return self.to_u32().unwrap();
} else if other.is_zero() {
return other;
return other.to_u32().unwrap();
}
#[allow(deprecated)]
self.__gcd_no_zero_check(other)
Expand Down
8 changes: 4 additions & 4 deletions src/utils/lcm.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use crate::utils::gcd::Gcd;

pub trait Lcm: Gcd {
fn lcm(self, other: Self) -> Self {
fn lcm(self, other: Self) -> u32 {
if self.is_zero() {
return self;
return self.to_u32().unwrap();
} else if other.is_zero() {
return other;
return other.to_u32().unwrap();
}
#[allow(deprecated)] // Internal call to save second zero checks.
{
(self * other) / (self.__gcd_no_zero_check(other))
(self * other).to_u32().unwrap() / (self.__gcd_no_zero_check(other))
}
}
}
Expand Down

0 comments on commit 604dcae

Please sign in to comment.