Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ngtkana committed Sep 29, 2023
1 parent a201a8b commit e26600e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions libs/fp2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
//! # Examples
//! ```
//! use fp2::fp;
//! use fp2::Fp;
//! type Fp = Fp<998244353>;
//! type Fp = fp2::Fp<998244353>;
//! let a = Fp::new(3);
//! let b = Fp::new(4);
//! assert_eq!(a + b, Fp::new(7));
Expand Down Expand Up @@ -168,12 +167,11 @@ impl<const P: u64> Fp<P> {
///
/// # Examples
/// ```
/// use fp2::Fp;
/// type Fp = Fp<998244353>;
/// assert_eq!(Fp::sign(0), Fp::new(1));
/// assert_eq!(Fp::sign(1), Fp::new(-1));
/// assert_eq!(Fp::sign(2), Fp::new(1));
/// assert_eq!(Fp::sign(3), Fp::new(-1));
/// type Fp = fp2::Fp<998244353>;
/// assert_eq!(Fp::sign(0), Fp::from(1));
/// assert_eq!(Fp::sign(1), Fp::from(-1));
/// assert_eq!(Fp::sign(2), Fp::from(1));
/// assert_eq!(Fp::sign(3), Fp::from(-1));
/// ```
pub fn sign(pow: usize) -> Self { Self::new(if pow % 2 == 0 { 1 } else { P - 1 }) }
}
Expand Down

0 comments on commit e26600e

Please sign in to comment.