From 252ce3d9b47408740bef81f1b6a33434395772fb Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Thu, 26 Sep 2024 15:34:35 +0800 Subject: [PATCH] call to_canonical_u64_vec from another impl trait --- ff_ext/src/lib.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) + } } }