@@ -556,9 +556,10 @@ pub trait Fp254Impl {
556556 let y = BigInt :: from_str ( & b. to_string ( ) ) . unwrap ( ) ;
557557 let modulus = & Fq :: modulus_as_bigint ( ) ;
558558 let q = ( x * y) / modulus;
559+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_1 ( ) . 2 ;
559560
560561 let script = script ! {
561- for _ in 0 ..Self :: N_LIMBS {
562+ for _ in 0 ..T_N_LIMBS {
562563 OP_DEPTH OP_1SUB OP_ROLL // hints
563564 }
564565 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -583,9 +584,10 @@ pub trait Fp254Impl {
583584 let y = BigInt :: from_str ( & constant. to_string ( ) ) . unwrap ( ) ;
584585 let modulus = & Fq :: modulus_as_bigint ( ) ;
585586 let q = ( x * y) / modulus;
587+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_1 ( ) . 2 ;
586588
587589 let script = script ! {
588- for _ in 0 ..Self :: N_LIMBS {
590+ for _ in 0 ..T_N_LIMBS {
589591 OP_DEPTH OP_1SUB OP_ROLL // hints
590592 }
591593 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -615,9 +617,10 @@ pub trait Fp254Impl {
615617 let y = BigInt :: from_str ( & b. to_string ( ) ) . unwrap ( ) ;
616618 let modulus = & Fq :: modulus_as_bigint ( ) ;
617619 let q = ( x * y) / modulus;
620+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_1 ( ) . 2 ;
618621
619622 let script = script ! {
620- for _ in 0 ..Self :: N_LIMBS {
623+ for _ in 0 ..T_N_LIMBS {
621624 OP_DEPTH OP_1SUB OP_ROLL // hints
622625 }
623626 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -653,9 +656,10 @@ pub trait Fp254Impl {
653656 let w = BigInt :: from_str ( & d. to_string ( ) ) . unwrap ( ) ;
654657
655658 let q = ( x * z + y * w) / modulus;
659+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_2 ( ) . 2 ;
656660
657661 let script = script ! {
658- for _ in 0 ..Self :: N_LIMBS {
662+ for _ in 0 ..T_N_LIMBS {
659663 OP_DEPTH OP_1SUB OP_ROLL // hints
660664 }
661665 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -696,9 +700,10 @@ pub trait Fp254Impl {
696700 let w = BigInt :: from_str ( & d. to_string ( ) ) . unwrap ( ) ;
697701
698702 let q = ( x * z + y * w) / modulus;
703+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_2_w4 ( ) . 2 ;
699704
700705 let script = script ! {
701- for _ in 0 ..Self :: N_LIMBS {
706+ for _ in 0 ..T_N_LIMBS {
702707 OP_DEPTH OP_1SUB OP_ROLL // hints
703708 }
704709 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -708,7 +713,7 @@ pub trait Fp254Impl {
708713 { Fq :: roll( d_depth + 4 ) }
709714 { Fq :: tmul_lc2_w4( ) }
710715 } ;
711- hints. push ( Hint :: BigIntegerTmulLC2 ( q) ) ;
716+ hints. push ( Hint :: BigIntegerTmulLC2W4 ( q) ) ;
712717
713718 ( script, hints)
714719 }
@@ -758,9 +763,10 @@ pub trait Fp254Impl {
758763 let w2 = BigInt :: from_str ( & h. to_string ( ) ) . unwrap ( ) ;
759764
760765 let q = ( x1 * x2 + y1 * y2 + z1 * z2 + w1 * w2) / modulus;
766+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_4 ( ) . 2 ;
761767
762768 let script = script ! {
763- for _ in 0 ..Self :: N_LIMBS {
769+ for _ in 0 ..T_N_LIMBS {
764770 OP_DEPTH OP_1SUB OP_ROLL // hints
765771 }
766772 // { fq_push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -802,9 +808,10 @@ pub trait Fp254Impl {
802808 let w = BigInt :: from_str ( & d. to_string ( ) ) . unwrap ( ) ;
803809
804810 let q = ( x * z + y * w) / modulus;
811+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_2 ( ) . 2 ;
805812
806813 let script = script ! {
807- for _ in 0 ..Self :: N_LIMBS {
814+ for _ in 0 ..T_N_LIMBS {
808815 OP_DEPTH OP_1SUB OP_ROLL // hints
809816 }
810817 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -843,9 +850,10 @@ pub trait Fp254Impl {
843850 let w = BigInt :: from_str ( & d. to_string ( ) ) . unwrap ( ) ;
844851
845852 let q = ( x * z + y * w) / modulus;
853+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_2_w4 ( ) . 2 ;
846854
847855 let script = script ! {
848- for _ in 0 ..Self :: N_LIMBS {
856+ for _ in 0 ..T_N_LIMBS {
849857 OP_DEPTH OP_1SUB OP_ROLL // hints
850858 }
851859 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -855,7 +863,7 @@ pub trait Fp254Impl {
855863 { Fq :: copy( d_depth + 4 ) }
856864 { Fq :: tmul_lc2_w4( ) }
857865 } ;
858- hints. push ( Hint :: BigIntegerTmulLC2 ( q) ) ;
866+ hints. push ( Hint :: BigIntegerTmulLC2W4 ( q) ) ;
859867
860868 ( script, hints)
861869 }
@@ -866,8 +874,10 @@ pub trait Fp254Impl {
866874 let x = & BigInt :: from_str ( & a. to_string ( ) ) . unwrap ( ) ;
867875 let modulus = & Fq :: modulus_as_bigint ( ) ;
868876 let q = ( x * x) / modulus;
877+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_1 ( ) . 2 ;
878+
869879 let script = script ! {
870- for _ in 0 ..Self :: N_LIMBS {
880+ for _ in 0 ..T_N_LIMBS {
871881 OP_DEPTH OP_1SUB OP_ROLL // hints
872882 }
873883 // { Fq::push(ark_bn254::Fq::from_str(&q.to_string()).unwrap()) }
@@ -886,11 +896,13 @@ pub trait Fp254Impl {
886896 let modulus = & Fq :: modulus_as_bigint ( ) ;
887897 let y = & x. modinv ( modulus) . unwrap ( ) ;
888898 let q = ( x * y) / modulus;
899+ const T_N_LIMBS : u32 = Fq :: bigint_tmul_lc_1 ( ) . 2 ;
900+
889901 let script = script ! {
890902 for _ in 0 ..Self :: N_LIMBS {
891903 OP_DEPTH OP_1SUB OP_ROLL // hints
892904 }
893- for _ in 0 ..Self :: N_LIMBS {
905+ for _ in 0 ..T_N_LIMBS {
894906 OP_DEPTH OP_1SUB OP_ROLL // hints
895907 }
896908 // { Fq::push(ark_bn254::Fq::from_str(&y.to_string()).unwrap()) }
0 commit comments