ff: Rename PrimeField::into_repr -> PrimeField::to_repr

This commit is contained in:
Jack Grigg
2020-05-02 18:55:13 +12:00
parent 9114c367f4
commit c597db59a6
35 changed files with 106 additions and 106 deletions

View File

@@ -221,7 +221,7 @@ impl<G: CurveProjective> Group<G::Engine> for Point<G> {
Point(G::zero())
}
fn group_mul_assign(&mut self, by: &G::Scalar) {
self.0.mul_assign(by.into_repr());
self.0.mul_assign(by.to_repr());
}
fn group_add_assign(&mut self, other: &Self) {
self.0.add_assign(&other.0);

View File

@@ -318,7 +318,7 @@ pub fn field_into_allocated_bits_le<E: ScalarEngine, CS: ConstraintSystem<E>, F:
let mut tmp = Vec::with_capacity(F::NUM_BITS as usize);
let mut found_one = false;
for b in BitIterator::<u8, _>::new(value.into_repr()) {
for b in BitIterator::<u8, _>::new(value.to_repr()) {
// Skip leading bits
found_one |= field_char.next().unwrap();
if !found_one {

View File

@@ -103,8 +103,8 @@ impl<E: ScalarEngine> AllocatedNum<E> {
// We want to ensure that the bit representation of a is
// less than or equal to r - 1.
let mut a = self.value.map(|e| BitIterator::<u8, _>::new(e.into_repr()));
let b = (-E::Fr::one()).into_repr();
let mut a = self.value.map(|e| BitIterator::<u8, _>::new(e.to_repr()));
let b = (-E::Fr::one()).to_repr();
let mut result = vec![];
@@ -557,7 +557,7 @@ mod test {
assert!(cs.is_satisfied());
for (b, a) in BitIterator::<u8, _>::new(r.into_repr())
for (b, a) in BitIterator::<u8, _>::new(r.to_repr())
.skip(1)
.zip(bits.iter().rev())
{

View File

@@ -106,7 +106,7 @@ fn hash_lc<E: ScalarEngine>(terms: &[(Variable, E::Fr)], h: &mut Blake2sState) {
}
}
let mut coeff_repr = coeff.into_repr();
let mut coeff_repr = coeff.to_repr();
<E::Fr as PrimeField>::ReprEndianness::toggle_little_endian(&mut coeff_repr);
let coeff_be: Vec<_> = coeff_repr.as_ref().iter().cloned().rev().collect();
buf[9..].copy_from_slice(&coeff_be[..]);

View File

@@ -287,7 +287,7 @@ impl PrimeField for Fr {
}
}
fn into_repr(&self) -> FrRepr {
fn to_repr(&self) -> FrRepr {
FrRepr::from(*self)
}

View File

@@ -31,7 +31,7 @@ pub fn verify_proof<'a, E: Engine>(
let mut acc = pvk.ic[0].into_projective();
for (i, b) in public_inputs.iter().zip(pvk.ic.iter().skip(1)) {
AddAssign::<&E::G1>::add_assign(&mut acc, &b.mul(i.into_repr()));
AddAssign::<&E::G1>::add_assign(&mut acc, &b.mul(i.to_repr()));
}
// The original verification equation is:

View File

@@ -195,7 +195,7 @@ where
bases.skip(1)?;
}
} else {
let mut exp = exp.into_repr();
let mut exp = exp.to_repr();
<<G::Engine as ScalarEngine>::Fr as PrimeField>::ReprEndianness::toggle_little_endian(&mut exp);
let exp = exp
@@ -305,7 +305,7 @@ fn test_with_bls12() {
let mut acc = G::zero();
for (base, exp) in bases.iter().zip(exponents.iter()) {
AddAssign::<&G>::add_assign(&mut acc, &base.mul(exp.into_repr()));
AddAssign::<&G>::add_assign(&mut acc, &base.mul(exp.to_repr()));
}
acc