Skip to content

Commit

Permalink
call to_canonical_u64_vec from another impl trait
Browse files Browse the repository at this point in the history
  • Loading branch information
hero78119 committed Sep 26, 2024
1 parent e8fe8c4 commit 252ce3d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ff_ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64> {
self.as_bases()
.iter()
.map(|a| a.to_canonical_u64())
.collect::<Vec<u64>>()
}
fn to_canonical_u64_vec(&self) -> Vec<u64>;
}

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;
Expand All @@ -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<u64> {
<GoldilocksExt2 as GoldilocksEF>::to_canonical_u64_vec(self)
}
}
}

0 comments on commit 252ce3d

Please sign in to comment.