airbender_crypto/bn254/fields/
fq2.rs1use super::Fq;
2#[cfg(any(
3 all(target_arch = "riscv32", feature = "bigint_ops"),
4 test,
5 feature = "proving"
6))]
7use crate::ark_ff_delegation::MontFp;
8#[cfg(not(any(
9 all(target_arch = "riscv32", feature = "bigint_ops"),
10 test,
11 feature = "proving"
12)))]
13use ark_ff::MontFp;
14use ark_ff::{AdditiveGroup, Field, Fp2, Fp2Config};
15pub type Fq2 = Fp2<Fq2Config>;
16
17pub struct Fq2Config;
18
19impl Fp2Config for Fq2Config {
20 type Fp = Fq;
21
22 const NONRESIDUE: Fq = MontFp!("-1");
24
25 const FROBENIUS_COEFF_FP2_C1: &'static [Fq] = &[
27 Fq::ONE,
29 MontFp!("-1"),
31 ];
32
33 #[inline(always)]
34 fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp {
35 fe.neg_in_place()
36 }
37}