diff --git a/ff_ext/src/lib.rs b/ff_ext/src/lib.rs index 3f7a5b785..5ebec4362 100644 --- a/ff_ext/src/lib.rs +++ b/ff_ext/src/lib.rs @@ -33,17 +33,12 @@ pub trait ExtensionField: fn from_limbs(limbs: &[Self::BaseField]) -> Self; /// Convert a field elements to a u64 vector - fn to_canonical_u64_vec(&self) -> Vec { - self.as_bases() - .iter() - .map(|a| a.to_canonical_u64()) - .collect::>() - } + fn to_canonical_u64_vec(&self) -> Vec; } mod impl_goldilocks { use crate::ExtensionField; - use goldilocks::{Goldilocks, GoldilocksExt2}; + use goldilocks::{ExtensionField as GoldilocksEF, Goldilocks, GoldilocksExt2}; impl ExtensionField for GoldilocksExt2 { const DEGREE: usize = 2; @@ -63,5 +58,9 @@ mod impl_goldilocks { fn from_limbs(limbs: &[Self::BaseField]) -> Self { Self([limbs[0], limbs[1]]) } + + fn to_canonical_u64_vec(&self) -> Vec { + ::to_canonical_u64_vec(self) + } } }