Skip to content

Commit

Permalink
++
Browse files Browse the repository at this point in the history
  • Loading branch information
qalisander committed Jan 29, 2025
1 parent 300ae09 commit ddc792c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lib/crypto/src/arithmetic/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ impl_from_primitive!(u128, from_u128);

impl<const N: usize> UpperHex for Uint<N> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result {
// Hex parse the limbs in reverse order.
// Concatenate hex representation of limbs in reversed order without
// allocations.
// By the end, it will produce actual hex of `Uint`.
let hex =
self.limbs.iter().rev().fold(String::new(), |mut output, &limb| {
let _ = write!(output, "{limb:016X}");
Expand Down
8 changes: 0 additions & 8 deletions lib/crypto/src/field/fp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ impl<P: FpParams<N>, const N: usize> Add<&Fp<P, N>> for Fp<P, N> {

#[inline]
fn add(mut self, other: &Self) -> Self {
use AddAssign;
self.add_assign(other);
self
}
Expand All @@ -721,7 +720,6 @@ impl<P: FpParams<N>, const N: usize> Sub<&Fp<P, N>> for Fp<P, N> {

#[inline]
fn sub(mut self, other: &Self) -> Self {
use SubAssign;
self.sub_assign(other);
self
}
Expand All @@ -732,7 +730,6 @@ impl<P: FpParams<N>, const N: usize> Mul<&Fp<P, N>> for Fp<P, N> {

#[inline]
fn mul(mut self, other: &Self) -> Self {
use MulAssign;
self.mul_assign(other);
self
}
Expand All @@ -745,7 +742,6 @@ impl<P: FpParams<N>, const N: usize> Div<&Fp<P, N>> for Fp<P, N> {
/// panics otherwise.
#[inline]
fn div(mut self, other: &Self) -> Self {
use MulAssign;
self.mul_assign(&other.inverse().unwrap());
self
}
Expand All @@ -756,7 +752,6 @@ impl<P: FpParams<N>, const N: usize> Add<&Fp<P, N>> for &Fp<P, N> {

#[inline]
fn add(self, other: &Fp<P, N>) -> Fp<P, N> {
use AddAssign;
let mut result = *self;
result.add_assign(other);
result
Expand All @@ -768,7 +763,6 @@ impl<P: FpParams<N>, const N: usize> Sub<&Fp<P, N>> for &Fp<P, N> {

#[inline]
fn sub(self, other: &Fp<P, N>) -> Fp<P, N> {
use SubAssign;
let mut result = *self;
result.sub_assign(other);
result
Expand All @@ -780,7 +774,6 @@ impl<P: FpParams<N>, const N: usize> Mul<&Fp<P, N>> for &Fp<P, N> {

#[inline]
fn mul(self, other: &Fp<P, N>) -> Fp<P, N> {
use MulAssign;
let mut result = *self;
result.mul_assign(other);
result
Expand All @@ -792,7 +785,6 @@ impl<P: FpParams<N>, const N: usize> Div<&Fp<P, N>> for &Fp<P, N> {

#[inline]
fn div(self, other: &Fp<P, N>) -> Fp<P, N> {
use DivAssign;
let mut result = *self;
result.div_assign(other);
result
Expand Down

0 comments on commit ddc792c

Please sign in to comment.