15
15
#define KRONECKER_SUBSTITUTION_TCC_
16
16
17
17
#include < algorithm>
18
- #include < math.h >
18
+ #include < cmath >
19
19
20
- #define GMP_LIMB_BITS 64
20
+ #include < gmp.h>
21
+ #include < libff/common/utils.hpp>
21
22
22
23
namespace libfqfft {
23
24
@@ -44,7 +45,7 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &
44
45
/* Output polynomial */
45
46
v3.resize (n3, FieldT::zero ());
46
47
47
- /*
48
+ /*
48
49
* Allocate all MP_LIMB_T space once and store the reference pointer M1
49
50
* to free memory afterwards. P1, P2, and P3 will remain fixed pointers
50
51
* to the start of their respective polynomials as reference.
@@ -72,7 +73,7 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &
72
73
val = v1[i].as_ulong ();
73
74
limb += (val << limb_b);
74
75
75
- /*
76
+ /*
76
77
* If the next iteration of LIMB_B is >= to the GMP_LIMB_BITS, then
77
78
* write it out to MP_LIMB_T* and reset LIMB. If VAL has remaining
78
79
* bits due to GMP_LIMB_BITS boundary, set it in LIMB and proceed.
@@ -99,7 +100,7 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &
99
100
val = v2[i].as_ulong ();
100
101
limb += (val << limb_b);
101
102
102
- /*
103
+ /*
103
104
* If the next iteration of LIMB_B is >= to the GMP_LIMB_BITS, then
104
105
* write it out to MP_LIMB_T* and reset LIMB. If VAL has remaining
105
106
* bits due to GMP_LIMB_BITS boundary, set it in LIMB and proceed.
@@ -130,7 +131,7 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &
130
131
limb_b = 0 ;
131
132
for (size_t i = 0 ; i < n3; i++)
132
133
{
133
- /*
134
+ /*
134
135
* If the coefficient's bit length is contained in LIMB, then
135
136
* write the masked value out to vector V3 and decrement LIMB
136
137
* by B bits.
@@ -142,7 +143,7 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &
142
143
delta = b;
143
144
delta_b = limb_b - delta;
144
145
}
145
- /*
146
+ /*
146
147
* If the remaining coefficient is across two LIMBs, then write
147
148
* to vector V3 the current limb's value and add upper bits from
148
149
* the second part. Lastly, decrement LIMB by the coefficient's
0 commit comments