Skip to content
Permalink
Browse files

Remove stale `{into,from}_repr_raw` methods on `PrimeField`.

  • Loading branch information
Pratyush committed Jan 5, 2020
1 parent 859430c commit e094e2127430521b7a882b0773bf1dc6852237b4
@@ -210,12 +210,6 @@ pub trait PrimeField: Field + FromStr {
/// Returns the underlying representation of the prime field element.
fn into_repr(&self) -> Self::BigInt;

/// Returns a prime field element from its underlying raw representation.
fn from_repr_raw(repr: Self::BigInt) -> Self;

/// Returns the underlying raw representation of the prime field element.
fn into_repr_raw(&self) -> Self::BigInt;

/// Returns a field element if the set of bytes forms a valid field element,
/// otherwise returns None.
fn from_random_bytes(bytes: &[u8]) -> Option<Self>;
@@ -295,22 +295,6 @@ impl<P: Fp256Parameters> PrimeField for Fp256<P> {
r.0
}

#[inline]
fn from_repr_raw(r: BigInteger) -> Self {
let r = Fp256(r, PhantomData);
if r.is_valid() {
r
} else {
Self::zero()
}
}

#[inline]
fn into_repr_raw(&self) -> BigInteger {
let r = *self;
r.0
}

#[inline]
fn from_random_bytes(bytes: &[u8]) -> Option<Self> {
let mut result = Self::zero();
@@ -322,22 +322,6 @@ impl<P: Fp320Parameters> PrimeField for Fp320<P> {
r.0
}

#[inline]
fn from_repr_raw(r: BigInteger) -> Self {
let r = Fp320(r, PhantomData);
if r.is_valid() {
r
} else {
Self::zero()
}
}

#[inline]
fn into_repr_raw(&self) -> BigInteger {
let r = *self;
r.0
}

#[inline]
fn from_random_bytes(bytes: &[u8]) -> Option<Self> {
let mut result = Self::zero();
@@ -353,21 +353,6 @@ impl<P: Fp384Parameters> PrimeField for Fp384<P> {
r.0
}

#[inline]
fn from_repr_raw(r: BigInteger) -> Self {
let r = Fp384(r, PhantomData);
if r.is_valid() {
r
} else {
Self::zero()
}
}

#[inline]
fn into_repr_raw(&self) -> BigInteger {
self.0
}

#[inline]
fn from_random_bytes(bytes: &[u8]) -> Option<Self> {
let mut result_bytes = vec![0u8; (Self::zero().0).0.len() * 8];
@@ -665,22 +665,6 @@ impl<P: Fp768Parameters> PrimeField for Fp768<P> {
r.0
}

#[inline]
fn from_repr_raw(r: BigInteger) -> Self {
let r = Fp768(r, PhantomData);
if r.is_valid() {
r
} else {
Self::zero()
}
}

#[inline]
fn into_repr_raw(&self) -> BigInteger {
let r = *self;
r.0
}

#[inline]
fn from_random_bytes(bytes: &[u8]) -> Option<Self> {
let mut result = Self::zero();
@@ -633,22 +633,6 @@ impl<P: Fp832Parameters> PrimeField for Fp832<P> {
r.0
}

#[inline]
fn from_repr_raw(r: BigInteger) -> Self {
let r = Fp832(r, PhantomData);
if r.is_valid() {
r
} else {
Self::zero()
}
}

#[inline]
fn into_repr_raw(&self) -> BigInteger {
let r = *self;
r.0
}

#[inline]
fn from_random_bytes(bytes: &[u8]) -> Option<Self> {
let mut result = Self::zero();

0 comments on commit e094e21

Please sign in to comment.
You can’t perform that action at this time.