diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index af759fd5..33423e36 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -18,6 +18,7 @@ macro(define_algebra_example name) endmacro() set(EXAMPLES_NAMES + "multiexp" "curves" "fields" "pairing" diff --git a/example/multi_exp.cpp b/example/multiexp.cpp similarity index 100% rename from example/multi_exp.cpp rename to example/multiexp.cpp diff --git a/include/nil/crypto3/algebra/curves/detail/scalar_mul.hpp b/include/nil/crypto3/algebra/curves/detail/scalar_mul.hpp index 06450de0..a6e8bae2 100644 --- a/include/nil/crypto3/algebra/curves/detail/scalar_mul.hpp +++ b/include/nil/crypto3/algebra/curves/detail/scalar_mul.hpp @@ -100,12 +100,11 @@ namespace nil { }*/ template::value && - !::nil::crypto3::detail::is_field::value && - ::nil::crypto3::detail::is_fp_field::value>::type> - GroupValueType operator*(const GroupValueType &left, const FieldValueType &right) { + typename FieldValueType> + typename std::enable_if<::nil::crypto3::detail::is_curve_group::value && + !::nil::crypto3::detail::is_field::value && + ::nil::crypto3::detail::is_fp_field::value, GroupValueType>::type + operator*(const GroupValueType &left, const FieldValueType &right) { // temporary added until fixed-precision modular adaptor is ready: typedef number> non_fixed_precision_modulus_type; @@ -114,12 +113,11 @@ namespace nil { } template::value && - !::nil::crypto3::detail::is_field::value && - ::nil::crypto3::detail::is_fp_field::value>::type> - GroupValueType operator*(const FieldValueType &left, const GroupValueType &right) { + typename FieldValueType> + typename std::enable_if<::nil::crypto3::detail::is_curve_group::value && + !::nil::crypto3::detail::is_field::value && + ::nil::crypto3::detail::is_fp_field::value, GroupValueType>::type + operator*(const FieldValueType &left, const GroupValueType &right) { return right * left; } diff --git a/include/nil/crypto3/algebra/random_element.hpp b/include/nil/crypto3/algebra/random_element.hpp index c69b8061..1f23728c 100644 --- a/include/nil/crypto3/algebra/random_element.hpp +++ b/include/nil/crypto3/algebra/random_element.hpp @@ -26,21 +26,24 @@ #ifndef CRYPTO3_ALGEBRA_RANDOM_ELEMENT_HPP #define CRYPTO3_ALGEBRA_RANDOM_ELEMENT_HPP +#include + namespace nil { namespace crypto3 { namespace algebra { - template::value && - !(::nil::crypto3::algebra::detail::is_field::value)>::type> - > typename CurveGroupType::value_type random_element() { + template + typename std::enable_if<::nil::crypto3::detail::is_curve_group::value, + typename CurveGroupType::value_type>::type + random_element() { + return CurveGroupType::value_type::one(); }; - template::value>::type> - > typename FieldType::value_type random_element() { + template + typename std::enable_if<::nil::crypto3::detail::is_field::value, + typename FieldType::value_type>::type + random_element() { return FieldType::value_type::one(); };