group: Default implementation of CurveProjective::batch_normalize
For convenience. Implementations will usually override this to take advantage of implementation-specific batching optimisations.
This commit is contained in:
parent
ae2d2b59b9
commit
3759fc8aab
|
@ -396,14 +396,6 @@ impl PrimeGroup for Fr {}
|
|||
impl CurveProjective for Fr {
|
||||
type Affine = Fr;
|
||||
|
||||
fn batch_normalize(p: &[Self], q: &mut [Self::Affine]) {
|
||||
assert_eq!(p.len(), q.len());
|
||||
|
||||
for (p, q) in p.iter().zip(q.iter_mut()) {
|
||||
*q = p.to_affine();
|
||||
}
|
||||
}
|
||||
|
||||
fn to_affine(&self) -> Fr {
|
||||
*self
|
||||
}
|
||||
|
|
|
@ -99,7 +99,13 @@ pub trait CurveProjective:
|
|||
|
||||
/// Converts a batch of projective elements into affine elements. This function will
|
||||
/// panic if `p.len() != q.len()`.
|
||||
fn batch_normalize(p: &[Self], q: &mut [Self::Affine]);
|
||||
fn batch_normalize(p: &[Self], q: &mut [Self::Affine]) {
|
||||
assert_eq!(p.len(), q.len());
|
||||
|
||||
for (p, q) in p.iter().zip(q.iter_mut()) {
|
||||
*q = p.to_affine();
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts this element into its affine representation.
|
||||
fn to_affine(&self) -> Self::Affine;
|
||||
|
|
Loading…
Reference in New Issue