Skip to content

Commit

Permalink
chore: code dedup in felt from bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Sep 19, 2024
1 parent b13ccec commit 2894abd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions crates/starknet-types-core/src/felt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,7 @@ impl From<&BigInt> for Felt {

impl From<BigInt> for Felt {
fn from(bigint: BigInt) -> Felt {
let (sign, bytes) = bigint.to_bytes_le();
let felt = Felt::from_bytes_le_slice(&bytes);
if sign == Sign::Minus {
felt.neg()
} else {
felt
}
Self::from(&bigint)
}
}
impl From<&BigUint> for Felt {
Expand All @@ -591,7 +585,7 @@ impl From<&BigUint> for Felt {

impl From<BigUint> for Felt {
fn from(biguint: BigUint) -> Felt {
Felt::from_bytes_le_slice(&biguint.to_bytes_le())
Self::from(&biguint)
}
}

Expand Down

0 comments on commit 2894abd

Please sign in to comment.