Skip to content

Commit

Permalink
Remove a few casts
Browse files Browse the repository at this point in the history
In an effort to be more readable use `usize::from` instead of a cast.

Refactor only, no logic changes.
  • Loading branch information
tcharding committed Jul 31, 2024
1 parent 49ddb1c commit 4a2372c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/primitives/gf32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ impl super::Field for Fe32 {
if self.0 == 0 || other.0 == 0 {
Fe32(0)
} else {
let log1 = LOG[self.0 as usize];
let log2 = LOG[other.0 as usize];
let log1 = LOG[usize::from(self.0)];
let log2 = LOG[usize::from(other.0)];
let mult_order = Self::MULTIPLICATIVE_ORDER as isize;
Fe32(LOG_INV[((log1 + log2) % mult_order) as usize])
}
Expand All @@ -282,8 +282,8 @@ impl super::Field for Fe32 {
} else if other.0 == 0 {
panic!("Attempt to divide {} by 0 in GF32", self);
} else {
let log1 = LOG[self.0 as usize];
let log2 = LOG[other.0 as usize];
let log1 = LOG[usize::from(self.0)];
let log2 = LOG[usize::from(other.0)];
let mult_order = Self::MULTIPLICATIVE_ORDER as isize;
Fe32(LOG_INV[((mult_order + log1 - log2) % mult_order) as usize])
}
Expand Down

0 comments on commit 4a2372c

Please sign in to comment.