Skip to content

Commit

Permalink
opti
Browse files Browse the repository at this point in the history
  • Loading branch information
SuccinctPaul committed Nov 20, 2023
1 parent 38226b8 commit fbea3fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
18 changes: 10 additions & 8 deletions starky/src/f3g.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ impl FieldExtension for F3G {
dim: 1,
};

const ZEROS: Self = F3G {
cube: [Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 3,
};
const ONES: Self = F3G {
cube: [Fr::ONE, Fr::ZERO, Fr::ZERO],
dim: 3,
};
#[inline(always)]
fn dim(&self) -> usize {
self.dim
Expand Down Expand Up @@ -256,18 +264,12 @@ impl ::rand::Rand for F3G {
impl plonky::Field for F3G {
#[inline(always)]
fn zero() -> Self {
F3G {
cube: [Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 3,
}
Self::ZEROS
}

#[inline(always)]
fn one() -> Self {
F3G {
cube: [Fr::ONE, Fr::ZERO, Fr::ZERO],
dim: 3,
}
Self::ONES
}

#[inline(always)]
Expand Down
20 changes: 11 additions & 9 deletions starky/src/f5g.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::hash::{Hash, Hasher};
use std::slice;

use core::fmt::{Display, Formatter};

/// Prime: 0xFFFFFFFF00000001
/// Irreducible polynomial: x^5-3
#[repr(C)]
Expand Down Expand Up @@ -47,7 +48,14 @@ impl FieldExtension for F5G {
cube: [Fr::ONE, Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 1,
};

const ZEROS: Self = F5G {
cube: [Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 5,
};
const ONES: Self = F5G {
cube: [Fr::ONE, Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 1,
};
#[inline(always)]
fn dim(&self) -> usize {
self.dim
Expand Down Expand Up @@ -229,18 +237,12 @@ impl ::rand::Rand for F5G {
impl plonky::Field for F5G {
#[inline(always)]
fn zero() -> Self {
F5G {
cube: [Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 1,
}
Self::ZEROS
}

#[inline(always)]
fn one() -> Self {
F5G {
cube: [Fr::ONE, Fr::ZERO, Fr::ZERO, Fr::ZERO, Fr::ZERO],
dim: 1,
}
Self::ONES
}

#[inline(always)]
Expand Down
4 changes: 2 additions & 2 deletions starky/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub trait FieldExtension:
const ZERO: Self;
const ONE: Self;

const ZEROS: Self = Self::zero();
const ONES: Self = Self::one();
const ZEROS: Self;
const ONES: Self;
const NEW_SIZE: u64 = 0;
fn dim(&self) -> usize;
fn from_vec(values: Vec<Fr>) -> Self;
Expand Down

0 comments on commit fbea3fe

Please sign in to comment.