Skip to content

Commit 840e682

Browse files
authored
fix: addressed few more overflow errors (#31)
2 parents dec1a65 + f60af2b commit 840e682

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/poseidon2/fields/koalabear/simd_montgomery.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub const koala_bear_simd = struct {
1818
// Field constants
1919
const modulus: u32 = 0x7f000001; // 2^31 - 2^24 + 1
2020
const mont_r: u64 = 1 << 32;
21-
const r_square_mod_modulus: u64 = @intCast((@as(u128, mont_r) * @as(u128, mont_r)) % @as(u128, modulus));
21+
const r_square_mod_modulus: u64 = 0x3f800001; // R^2 mod p for p = 0x7f000001
2222
const modulus_prime: u32 = 0x81000001; // -modulus^-1 mod 2^32
2323

2424
// SIMD-optimized Montgomery reduction

0 commit comments

Comments
 (0)