Rename combine_coeffs to reduce

This commit is contained in:
Henry de Valence 2017-03-12 23:18:34 -07:00
parent f16f5d1e73
commit 7f8b3fe594

View file

@ -379,7 +379,7 @@ impl FieldElement {
} }
#[cfg(feature="radix_25_5")] #[cfg(feature="radix_25_5")]
fn combine_coeffs(input: &[i64;10]) -> FieldElement { //FeCombine fn reduce(input: &[i64;10]) -> FieldElement { //FeCombine
let mut c = [0i64;10]; let mut c = [0i64;10];
let mut h = input.clone(); let mut h = input.clone();
@ -505,7 +505,7 @@ impl FieldElement {
h[8] = load3(&data[26..]) << 4; h[8] = load3(&data[26..]) << 4;
h[9] = (load3(&data[29..]) & 8388607) << 2; h[9] = (load3(&data[29..]) & 8388607) << 2;
FieldElement::combine_coeffs(&h) FieldElement::reduce(&h)
} }
/// Marshal this FieldElement into a 32-byte array. /// Marshal this FieldElement into a 32-byte array.
@ -828,7 +828,7 @@ impl FieldElement {
let h8 = f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19; let h8 = f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19;
let h9 = f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0; let h9 = f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0;
FieldElement::combine_coeffs(&[h0, h1, h2, h3, h4, h5, h6, h7, h8, h9]) FieldElement::reduce(&[h0, h1, h2, h3, h4, h5, h6, h7, h8, h9])
} }
#[cfg(feature="radix_25_5")] #[cfg(feature="radix_25_5")]
@ -885,7 +885,7 @@ impl FieldElement {
/// * |h[i]| bounded by 1.1*2^25, 1.1*2^24, 1.1*2^25, 1.1*2^24, etc. /// * |h[i]| bounded by 1.1*2^25, 1.1*2^24, 1.1*2^25, 1.1*2^24, etc.
#[cfg(feature="radix_25_5")] #[cfg(feature="radix_25_5")]
pub fn square(&self) -> FieldElement { pub fn square(&self) -> FieldElement {
FieldElement::combine_coeffs(&self.square_inner()) FieldElement::reduce(&self.square_inner())
} }
/// Square this field element and multiply the result by 2. /// Square this field element and multiply the result by 2.
@ -910,7 +910,7 @@ impl FieldElement {
for i in 0..self.0.len() { for i in 0..self.0.len() {
coeffs[i] += coeffs[i]; coeffs[i] += coeffs[i];
} }
FieldElement::combine_coeffs(&coeffs) FieldElement::reduce(&coeffs)
} }
#[inline] #[inline]