Skip to content

cleanup/refactor fields #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
465 changes: 465 additions & 0 deletions algebra-core/src/fields/arithmetic.rs

Large diffs are not rendered by default.

484 changes: 10 additions & 474 deletions algebra-core/src/fields/macros.rs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions algebra-core/src/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use core::{

use num_traits::{One, Zero};

#[macro_use]
pub mod arithmetic;

#[macro_use]
pub mod macros;
pub mod models;
Expand Down
18 changes: 0 additions & 18 deletions algebra-core/src/fields/models/fp_256.rs

This file was deleted.

18 changes: 0 additions & 18 deletions algebra-core/src/fields/models/fp_320.rs

This file was deleted.

18 changes: 0 additions & 18 deletions algebra-core/src/fields/models/fp_384.rs

This file was deleted.

18 changes: 0 additions & 18 deletions algebra-core/src/fields/models/fp_768.rs

This file was deleted.

17 changes: 0 additions & 17 deletions algebra-core/src/fields/models/fp_832.rs

This file was deleted.

38 changes: 24 additions & 14 deletions algebra-core/src/fields/models/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
pub mod fp_256;
pub use self::fp_256::*;

pub mod fp_320;
pub use self::fp_320::*;

pub mod fp_384;
pub use self::fp_384::*;

pub mod fp_768;
pub use self::fp_768::*;

pub mod fp_832;
pub use self::fp_832::*;
use core::{
cmp::{Ord, Ordering, PartialOrd},
fmt::{Display, Formatter, Result as FmtResult},
marker::PhantomData,
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},
str::FromStr,
};
use num_traits::{One, Zero};
use unroll::unroll_for_loops;

use crate::{
biginteger::{arithmetic as fa, BigInteger as _BigInteger,
BigInteger256, BigInteger320, BigInteger384, BigInteger768, BigInteger832},
bytes::{FromBytes, ToBytes},
fields::{Field, FpParameters, LegendreSymbol, PrimeField, SquareRootField},
io::{Read, Result as IoResult, Write},
serialize::CanonicalDeserialize,
};

impl_Fp!(Fp256, Fp256Parameters, BigInteger256, BigInteger256, 4);
impl_Fp!(Fp320, Fp320Parameters, BigInteger320, BigInteger320, 5);
impl_Fp!(Fp384, Fp384Parameters, BigInteger384, BigInteger384, 6);
impl_Fp!(Fp768, Fp768Parameters, BigInteger768, BigInteger768, 12);
impl_Fp!(Fp832, Fp832Parameters, BigInteger832, BigInteger832, 13);

pub mod fp2;
pub use self::fp2::*;
Expand Down