Skip to content

Commit

Permalink
Calculate s correctly in inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
cronokirby committed Jan 12, 2024
1 parent ff1d7d8 commit 2750d86
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/fields/fp/u32/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Fp {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (32 - 1)) & 1) as u8;
let mut neg = fiat::FpMontgomeryDomainFieldElement([0; N]);
fiat::fp_opp(&mut neg, &fiat::FpMontgomeryDomainFieldElement(v));

Expand Down
2 changes: 1 addition & 1 deletion src/fields/fp/u64/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Fp {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (64 - 1)) & 1) as u8;
let mut neg = fiat::FpMontgomeryDomainFieldElement([0; N]);
fiat::fp_opp(&mut neg, &fiat::FpMontgomeryDomainFieldElement(v));

Expand Down
2 changes: 1 addition & 1 deletion src/fields/fq/u32/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Fq {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (32 - 1)) & 1) as u8;
let mut neg = fiat::FqMontgomeryDomainFieldElement([0; N]);
fiat::fq_opp(&mut neg, &fiat::FqMontgomeryDomainFieldElement(v));

Expand Down
2 changes: 1 addition & 1 deletion src/fields/fq/u64/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Fq {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (64 - 1)) & 1) as u8;
let mut neg = fiat::FqMontgomeryDomainFieldElement([0; N]);
fiat::fq_opp(&mut neg, &fiat::FqMontgomeryDomainFieldElement(v));

Expand Down
2 changes: 1 addition & 1 deletion src/fields/fr/u32/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Fr {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (32 - 1)) & 1) as u8;
let mut neg = fiat::FrMontgomeryDomainFieldElement([0; N]);
fiat::fr_opp(&mut neg, &fiat::FrMontgomeryDomainFieldElement(v));

Expand Down
2 changes: 1 addition & 1 deletion src/fields/fr/u64/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Fr {
f = out2;
}

let s = ((f[f.len() - 1] >> 32 - 1) & 1) as u8;
let s = ((f[f.len() - 1] >> (64 - 1)) & 1) as u8;
let mut neg = fiat::FrMontgomeryDomainFieldElement([0; N]);
fiat::fr_opp(&mut neg, &fiat::FrMontgomeryDomainFieldElement(v));

Expand Down

0 comments on commit 2750d86

Please sign in to comment.