Skip to content

Commit

Permalink
support win/mac with MCL_USE_GMP=1
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Jun 13, 2024
1 parent 13c265c commit c6edb73
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/msm_avx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ inline void toArray(Unit x[N], const mpz_class& mx)
template<size_t N>
inline mpz_class fromArray(const Unit x[N])
{
mpz_class mx = x[N-1];
mpz_class mx;
mcl::gmp::setUnit(mx, x[N-1]);
for (size_t i = 1; i < N; i++) {
mx <<= W;
mx += x[N-1-i];
mcl::gmp::addUnit(mx, x[N-1-i]);
}
return mx;
}
Expand Down Expand Up @@ -567,9 +568,10 @@ class Montgomery {
void mod(mpz_class& z, const mpz_class& xy) const
{
z = xy;
mpz_class t;
for (size_t i = 0; i < N; i++) {
Unit q = (getLow(z) * rp) & g_mask;
mpz_class t = q;
mcl::gmp::setUnit(t, q);
z += mp * t;
z >>= W;
}
Expand Down

0 comments on commit c6edb73

Please sign in to comment.