Use constants where applicable in field implementations

Co-authored-by: str4d <jack@electriccoin.co>
This commit is contained in:
ebfull 2020-12-11 11:54:32 -07:00 committed by GitHub
parent 81345e0cf1
commit 0101014268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -816,7 +816,7 @@ fn test_zeta() {
#[test]
fn test_root_of_unity() {
assert_eq!(
Fp::ROOT_OF_UNITY.pow_vartime(&[1 << 32, 0, 0, 0]),
Fp::ROOT_OF_UNITY.pow_vartime(&[1 << Fp::S, 0, 0, 0]),
Fp::one()
);
}
@ -833,7 +833,8 @@ fn test_inv_2() {
#[test]
fn test_delta() {
assert_eq!(Fp::DELTA, Fp::from(5).pow(&[1u64 << Fp::S, 0, 0, 0]));
assert_eq!(Fp::DELTA, GENERATOR.pow(&[1u64 << Fp::S, 0, 0, 0]));
assert_eq!(Fp::DELTA, Fp::multiplicative_generator().pow(&[1u64 << Fp::S, 0, 0, 0]));
}
#[cfg(not(target_pointer_width = "64"))]

View File

@ -815,7 +815,7 @@ fn test_zeta() {
#[test]
fn test_root_of_unity() {
assert_eq!(
Fq::ROOT_OF_UNITY.pow_vartime(&[1 << 32, 0, 0, 0]),
Fq::ROOT_OF_UNITY.pow_vartime(&[1 << Fq::S, 0, 0, 0]),
Fq::one()
);
}
@ -832,7 +832,8 @@ fn test_inv_2() {
#[test]
fn test_delta() {
assert_eq!(Fq::DELTA, Fq::from(5).pow(&[1u64 << Fq::S, 0, 0, 0]));
assert_eq!(Fq::DELTA, GENERATOR.pow(&[1u64 << Fq::S, 0, 0, 0]));
assert_eq!(Fq::DELTA, Fq::multiplicative_generator().pow(&[1u64 << Fq::S, 0, 0, 0]));
}
#[cfg(not(target_pointer_width = "64"))]