Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang compatibility fixes #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Modifies template and macro declarations for clang compatibility
kobigurk committed Mar 18, 2017
commit b16a29f9f91f224e5776ae887db7197c19a24b46
6 changes: 3 additions & 3 deletions src/algebra/curves/alt_bn128/alt_bn128_g1.hpp
Original file line number Diff line number Diff line change
@@ -77,10 +77,10 @@ alt_bn128_G1 operator*(const bigint<m> &lhs, const alt_bn128_G1 &rhs)
return scalar_mul<alt_bn128_G1, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
alt_bn128_G1 operator*(const Fp_model<m,modulus_p> &lhs, const alt_bn128_G1 &rhs)
template<typename T>
alt_bn128_G1 operator*(const T &lhs, const alt_bn128_G1 &rhs)
{
return scalar_mul<alt_bn128_G1, m>(rhs, lhs.as_bigint());
return scalar_mul<alt_bn128_G1, T::num_limbs>(rhs, lhs.as_bigint());
}

std::ostream& operator<<(std::ostream& out, const std::vector<alt_bn128_G1> &v);
6 changes: 3 additions & 3 deletions src/algebra/curves/alt_bn128/alt_bn128_g2.hpp
Original file line number Diff line number Diff line change
@@ -81,10 +81,10 @@ alt_bn128_G2 operator*(const bigint<m> &lhs, const alt_bn128_G2 &rhs)
return scalar_mul<alt_bn128_G2, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
alt_bn128_G2 operator*(const Fp_model<m,modulus_p> &lhs, const alt_bn128_G2 &rhs)
template<typename T>
alt_bn128_G2 operator*(const T &lhs, const alt_bn128_G2 &rhs)
{
return scalar_mul<alt_bn128_G2, m>(rhs, lhs.as_bigint());
return scalar_mul<alt_bn128_G2, T::num_limbs>(rhs, lhs.as_bigint());
}

template<typename T>
8 changes: 4 additions & 4 deletions src/algebra/curves/bn128/bn128_g1.hpp
Original file line number Diff line number Diff line change
@@ -75,11 +75,11 @@ bn128_G1 operator*(const bigint<m> &lhs, const bn128_G1 &rhs)
{
return scalar_mul<bn128_G1, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
bn128_G1 operator*(const Fp_model<m,modulus_p> &lhs, const bn128_G1 &rhs)
template<typename T>
bn128_G1 operator*(const T &lhs, const bn128_G1 &rhs)
{
return scalar_mul<bn128_G1, m>(rhs, lhs.as_bigint());
return scalar_mul<bn128_G1, T::num_limbs>(rhs, lhs.as_bigint());
}

std::ostream& operator<<(std::ostream& out, const std::vector<bn128_G1> &v);
15 changes: 13 additions & 2 deletions src/algebra/curves/bn128/bn128_g2.hpp
Original file line number Diff line number Diff line change
@@ -77,11 +77,22 @@ bn128_G2 operator*(const bigint<m> &lhs, const bn128_G2 &rhs)
return scalar_mul<bn128_G2, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
bn128_G2 operator*(const Fp_model<m, modulus_p> &lhs, const bn128_G2 &rhs)

template<typename T>
bn128_G2 operator*(const T &lhs, const bn128_G2 &rhs)
{
return scalar_mul<bn128_G2, T::num_limbs>(rhs, lhs.as_bigint());
}



/*
template<mp_size_t m>
bn128_G2 operator*(const Fp_model<m, libff::bn128_modulus_r> &lhs, const bn128_G2 &rhs)
{
return scalar_mul<bn128_G2, m>(rhs, lhs.as_bigint());
}
*/

template<typename T>
void batch_to_special_all_non_zeros(std::vector<T> &vec);
6 changes: 3 additions & 3 deletions src/algebra/curves/edwards/edwards_g1.hpp
Original file line number Diff line number Diff line change
@@ -79,10 +79,10 @@ edwards_G1 operator*(const bigint<m> &lhs, const edwards_G1 &rhs)
return scalar_mul<edwards_G1, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
edwards_G1 operator*(const Fp_model<m,modulus_p> &lhs, const edwards_G1 &rhs)
template<typename T>
edwards_G1 operator*(const T &lhs, const edwards_G1 &rhs)
{
return scalar_mul<edwards_G1, m>(rhs, lhs.as_bigint());
return scalar_mul<edwards_G1, T::num_limbs>(rhs, lhs.as_bigint());
}

std::ostream& operator<<(std::ostream& out, const std::vector<edwards_G1> &v);
6 changes: 3 additions & 3 deletions src/algebra/curves/edwards/edwards_g2.hpp
Original file line number Diff line number Diff line change
@@ -85,10 +85,10 @@ edwards_G2 operator*(const bigint<m> &lhs, const edwards_G2 &rhs)
return scalar_mul<edwards_G2, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
edwards_G2 operator*(const Fp_model<m, modulus_p> &lhs, const edwards_G2 &rhs)
template<typename T>
edwards_G2 operator*(const T &lhs, const edwards_G2 &rhs)
{
return scalar_mul<edwards_G2, m>(rhs, lhs.as_bigint());
return scalar_mul<edwards_G2, T::num_limbs>(rhs, lhs.as_bigint());
}

template<typename T>
6 changes: 3 additions & 3 deletions src/algebra/curves/mnt/mnt4/mnt4_g1.hpp
Original file line number Diff line number Diff line change
@@ -90,10 +90,10 @@ mnt4_G1 operator*(const bigint<m> &lhs, const mnt4_G1 &rhs)
return scalar_mul<mnt4_G1, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
mnt4_G1 operator*(const Fp_model<m,modulus_p> &lhs, const mnt4_G1 &rhs)
template<typename T>
mnt4_G1 operator*(const T &lhs, const mnt4_G1 &rhs)
{
return scalar_mul<mnt4_G1, m>(rhs, lhs.as_bigint());
return scalar_mul<mnt4_G1, T::num_limbs>(rhs, lhs.as_bigint());
}

std::ostream& operator<<(std::ostream& out, const std::vector<mnt4_G1> &v);
6 changes: 3 additions & 3 deletions src/algebra/curves/mnt/mnt4/mnt4_g2.hpp
Original file line number Diff line number Diff line change
@@ -95,10 +95,10 @@ mnt4_G2 operator*(const bigint<m> &lhs, const mnt4_G2 &rhs)
return scalar_mul<mnt4_G2, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
mnt4_G2 operator*(const Fp_model<m,modulus_p> &lhs, const mnt4_G2 &rhs)
template<typename T>
mnt4_G2 operator*(const T &lhs, const mnt4_G2 &rhs)
{
return scalar_mul<mnt4_G2, m>(rhs, lhs.as_bigint());
return scalar_mul<mnt4_G2, T::num_limbs>(rhs, lhs.as_bigint());
}

template<typename T>
6 changes: 3 additions & 3 deletions src/algebra/curves/mnt/mnt6/mnt6_g1.hpp
Original file line number Diff line number Diff line change
@@ -90,10 +90,10 @@ mnt6_G1 operator*(const bigint<m> &lhs, const mnt6_G1 &rhs)
return scalar_mul<mnt6_G1, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
mnt6_G1 operator*(const Fp_model<m,modulus_p> &lhs, const mnt6_G1 &rhs)
template<typename T>
mnt6_G1 operator*(const T &lhs, const mnt6_G1 &rhs)
{
return scalar_mul<mnt6_G1, m>(rhs, lhs.as_bigint());
return scalar_mul<mnt6_G1, T::num_limbs>(rhs, lhs.as_bigint());
}

std::ostream& operator<<(std::ostream& out, const std::vector<mnt6_G1> &v);
6 changes: 3 additions & 3 deletions src/algebra/curves/mnt/mnt6/mnt6_g2.hpp
Original file line number Diff line number Diff line change
@@ -95,10 +95,10 @@ mnt6_G2 operator*(const bigint<m> &lhs, const mnt6_G2 &rhs)
return scalar_mul<mnt6_G2, m>(rhs, lhs);
}

template<mp_size_t m, const bigint<m>& modulus_p>
mnt6_G2 operator*(const Fp_model<m,modulus_p> &lhs, const mnt6_G2 &rhs)
template<typename T>
mnt6_G2 operator*(const T &lhs, const mnt6_G2 &rhs)
{
return scalar_mul<mnt6_G2, m>(rhs, lhs.as_bigint());
return scalar_mul<mnt6_G2, T::num_limbs>(rhs, lhs.as_bigint());
}

template<typename T>
2 changes: 1 addition & 1 deletion src/common/utils.hpp
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ void UNUSED(Types&&...) {}
#ifdef DEBUG
#define FMT FORMAT
#else
#define FMT(...) (UNUSED(__VA_ARGS__), "")
#define FMT(...) UNUSED(__VA_ARGS__)
#endif

void serialize_bit_vector(std::ostream &out, const bit_vector &v);