diff --git a/src/algebra/curves/alt_bn128/alt_bn128_g1.hpp b/src/algebra/curves/alt_bn128/alt_bn128_g1.hpp index 1199cc7b..ce7fb3e5 100755 --- a/src/algebra/curves/alt_bn128/alt_bn128_g1.hpp +++ b/src/algebra/curves/alt_bn128/alt_bn128_g1.hpp @@ -77,10 +77,10 @@ alt_bn128_G1 operator*(const bigint &lhs, const alt_bn128_G1 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -alt_bn128_G1 operator*(const Fp_model &lhs, const alt_bn128_G1 &rhs) +template +alt_bn128_G1 operator*(const T &lhs, const alt_bn128_G1 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } std::ostream& operator<<(std::ostream& out, const std::vector &v); diff --git a/src/algebra/curves/alt_bn128/alt_bn128_g2.hpp b/src/algebra/curves/alt_bn128/alt_bn128_g2.hpp index b3b58984..0b51d44b 100755 --- a/src/algebra/curves/alt_bn128/alt_bn128_g2.hpp +++ b/src/algebra/curves/alt_bn128/alt_bn128_g2.hpp @@ -81,10 +81,10 @@ alt_bn128_G2 operator*(const bigint &lhs, const alt_bn128_G2 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -alt_bn128_G2 operator*(const Fp_model &lhs, const alt_bn128_G2 &rhs) +template +alt_bn128_G2 operator*(const T &lhs, const alt_bn128_G2 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } template diff --git a/src/algebra/curves/bn128/bn128_g1.hpp b/src/algebra/curves/bn128/bn128_g1.hpp index d022df3a..90af54a2 100755 --- a/src/algebra/curves/bn128/bn128_g1.hpp +++ b/src/algebra/curves/bn128/bn128_g1.hpp @@ -75,11 +75,11 @@ bn128_G1 operator*(const bigint &lhs, const bn128_G1 &rhs) { return scalar_mul(rhs, lhs); } - -template& modulus_p> -bn128_G1 operator*(const Fp_model &lhs, const bn128_G1 &rhs) + +template +bn128_G1 operator*(const T &lhs, const bn128_G1 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } std::ostream& operator<<(std::ostream& out, const std::vector &v); diff --git a/src/algebra/curves/bn128/bn128_g2.hpp b/src/algebra/curves/bn128/bn128_g2.hpp index 98d9420c..ed2de5b0 100755 --- a/src/algebra/curves/bn128/bn128_g2.hpp +++ b/src/algebra/curves/bn128/bn128_g2.hpp @@ -77,11 +77,22 @@ bn128_G2 operator*(const bigint &lhs, const bn128_G2 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -bn128_G2 operator*(const Fp_model &lhs, const bn128_G2 &rhs) + +template +bn128_G2 operator*(const T &lhs, const bn128_G2 &rhs) +{ + return scalar_mul(rhs, lhs.as_bigint()); +} + + + +/* +template +bn128_G2 operator*(const Fp_model &lhs, const bn128_G2 &rhs) { return scalar_mul(rhs, lhs.as_bigint()); } +*/ template void batch_to_special_all_non_zeros(std::vector &vec); diff --git a/src/algebra/curves/edwards/edwards_g1.hpp b/src/algebra/curves/edwards/edwards_g1.hpp index 8cca442c..63841b9b 100755 --- a/src/algebra/curves/edwards/edwards_g1.hpp +++ b/src/algebra/curves/edwards/edwards_g1.hpp @@ -79,10 +79,10 @@ edwards_G1 operator*(const bigint &lhs, const edwards_G1 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -edwards_G1 operator*(const Fp_model &lhs, const edwards_G1 &rhs) +template +edwards_G1 operator*(const T &lhs, const edwards_G1 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } std::ostream& operator<<(std::ostream& out, const std::vector &v); diff --git a/src/algebra/curves/edwards/edwards_g2.hpp b/src/algebra/curves/edwards/edwards_g2.hpp index 562bacc0..a1ef6ac7 100755 --- a/src/algebra/curves/edwards/edwards_g2.hpp +++ b/src/algebra/curves/edwards/edwards_g2.hpp @@ -85,10 +85,10 @@ edwards_G2 operator*(const bigint &lhs, const edwards_G2 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -edwards_G2 operator*(const Fp_model &lhs, const edwards_G2 &rhs) +template +edwards_G2 operator*(const T &lhs, const edwards_G2 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } template diff --git a/src/algebra/curves/mnt/mnt4/mnt4_g1.hpp b/src/algebra/curves/mnt/mnt4/mnt4_g1.hpp index 194118c1..cec0cfe8 100755 --- a/src/algebra/curves/mnt/mnt4/mnt4_g1.hpp +++ b/src/algebra/curves/mnt/mnt4/mnt4_g1.hpp @@ -90,10 +90,10 @@ mnt4_G1 operator*(const bigint &lhs, const mnt4_G1 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -mnt4_G1 operator*(const Fp_model &lhs, const mnt4_G1 &rhs) +template +mnt4_G1 operator*(const T &lhs, const mnt4_G1 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } std::ostream& operator<<(std::ostream& out, const std::vector &v); diff --git a/src/algebra/curves/mnt/mnt4/mnt4_g2.hpp b/src/algebra/curves/mnt/mnt4/mnt4_g2.hpp index 33546e91..9f1bf223 100755 --- a/src/algebra/curves/mnt/mnt4/mnt4_g2.hpp +++ b/src/algebra/curves/mnt/mnt4/mnt4_g2.hpp @@ -95,10 +95,10 @@ mnt4_G2 operator*(const bigint &lhs, const mnt4_G2 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -mnt4_G2 operator*(const Fp_model &lhs, const mnt4_G2 &rhs) +template +mnt4_G2 operator*(const T &lhs, const mnt4_G2 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } template diff --git a/src/algebra/curves/mnt/mnt6/mnt6_g1.hpp b/src/algebra/curves/mnt/mnt6/mnt6_g1.hpp index 187fd306..8b88bfa8 100755 --- a/src/algebra/curves/mnt/mnt6/mnt6_g1.hpp +++ b/src/algebra/curves/mnt/mnt6/mnt6_g1.hpp @@ -90,10 +90,10 @@ mnt6_G1 operator*(const bigint &lhs, const mnt6_G1 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -mnt6_G1 operator*(const Fp_model &lhs, const mnt6_G1 &rhs) +template +mnt6_G1 operator*(const T &lhs, const mnt6_G1 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } std::ostream& operator<<(std::ostream& out, const std::vector &v); diff --git a/src/algebra/curves/mnt/mnt6/mnt6_g2.hpp b/src/algebra/curves/mnt/mnt6/mnt6_g2.hpp index 052c9fe3..a4d5eb6f 100755 --- a/src/algebra/curves/mnt/mnt6/mnt6_g2.hpp +++ b/src/algebra/curves/mnt/mnt6/mnt6_g2.hpp @@ -95,10 +95,10 @@ mnt6_G2 operator*(const bigint &lhs, const mnt6_G2 &rhs) return scalar_mul(rhs, lhs); } -template& modulus_p> -mnt6_G2 operator*(const Fp_model &lhs, const mnt6_G2 &rhs) +template +mnt6_G2 operator*(const T &lhs, const mnt6_G2 &rhs) { - return scalar_mul(rhs, lhs.as_bigint()); + return scalar_mul(rhs, lhs.as_bigint()); } template diff --git a/src/common/utils.hpp b/src/common/utils.hpp index 44a5a4de..5c8d9f5c 100755 --- a/src/common/utils.hpp +++ b/src/common/utils.hpp @@ -38,14 +38,15 @@ bool is_little_endian(); std::string FORMAT(const std::string &prefix, const char* format, ...); +const std::string empty(""); /* A variadic template to suppress unused argument warnings */ template -void UNUSED(Types&&...) {} +const std::string& UNUSED(Types&&...) { return empty; } #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);