Skip to content

Commit

Permalink
Merge #194: Remove a few casts
Browse files Browse the repository at this point in the history
300efbb Remove a few casts (Tobin C. Harding)

Pull request description:

  In an effort to be more readable use `usize::from` instead of a cast. There are a few casts left but this all the ones that can use `From`.

  Refactor only, no logic changes.

  Close #181

ACKs for top commit:
  apoelstra:
    ACK 300efbb successfully ran local tests

Tree-SHA512: d955655b28c74dd5d240aef65b925fd695a2e703afe7a29be5c121509ebaa041dbd3f3b010a2c6ef02abf95cddd73fd4dc8939dd5525c8967316a4f6efb9485a
  • Loading branch information
apoelstra committed Aug 6, 2024
2 parents b9eb76f + 300efbb commit aa9de8f
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 aa9de8f

Please sign in to comment.