Skip to content

Commit

Permalink
Remove some unnecessary TODOs.
Browse files Browse the repository at this point in the history
  • Loading branch information
martun committed Aug 6, 2024
1 parent 7bd38cb commit 16f94a3
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,12 @@ namespace nil {
}

constexpr element_fp &operator-=(const element_fp &B) {
// TODO(martun): consider directly taking the backend and calling
// eval_add to improve performance.
data -= B.data;

return *this;
}

constexpr element_fp &operator+=(const element_fp &B) {
// TODO(martun): consider directly taking the backend and calling
// eval_add to improve performance.
data += B.data;

return *this;
Expand Down Expand Up @@ -224,10 +220,6 @@ namespace nil {
return element_fp(inverse_mod(data));
}

// TODO: complete method
constexpr element_fp _2z_add_3x() {
}

constexpr element_fp squared() const {
return element_fp(data * data); // maybe can be done more effective
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace nil {

element_fp12_2over3over2 sqrt() const {

// compute squared root with Tonelli--Shanks
// TODO: compute squared root with Tonelli--Shanks
}

element_fp12_2over3over2 squared() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ namespace nil {
}

constexpr element_fp2 operator*(const element_fp2 &B) const {
// TODO: the use of data and B.data directly in return statement addition cause constexpr
// error for gcc
const underlying_type A0 = data[0], A1 = data[1], B0 = B.data[0], B1 = B.data[1];
const underlying_type A0B0 = data[0] * B.data[0], A1B1 = data[1] * B.data[1];

Expand Down Expand Up @@ -185,10 +183,6 @@ namespace nil {
return element_fp2(-(data[1] * y_b), data[0] * y_b);
}

constexpr element_fp2 _2z_add_3x() {
return element_fp2(data[0]._2z_add_3x(), data[1]._2z_add_3x());
}

constexpr element_fp2 divBy2() const {
return element_fp2(divBy2(data[0]), divBy2(data[1]));
}
Expand Down Expand Up @@ -245,12 +239,9 @@ namespace nil {
}

constexpr element_fp2 squared() const {
// return (*this) * (*this); // maybe can be done more effective

/* Devegili OhEig Scott Dahab --- Multiplication and Squaring on Pairing-Friendly
* Fields.pdf; Section 3 (Complex squaring) */
// TODO: reference here could cause error in constexpr for gcc
const underlying_type A = data[0], B = data[1];
const underlying_type& A = data[0], B = data[1];
const underlying_type AB = A * B;

return element_fp2((A + B) * (A + non_residue * B) - AB - non_residue * AB, AB + AB);
Expand All @@ -261,8 +252,7 @@ namespace nil {

/* Devegili OhEig Scott Dahab --- Multiplication and Squaring on Pairing-Friendly
* Fields.pdf; Section 3 (Complex squaring) */
// TODO: reference here could cause error in constexpr for gcc
const underlying_type A = data[0], B = data[1];
const underlying_type& A = data[0], B = data[1];
const underlying_type AB = A * B;

data[0] = (A + B) * (A + non_residue * B) - AB - non_residue * AB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ namespace nil {
BOOST_ASSERT_MSG(val.size() == detail::power_of_two(val.size()),
"DFS optimal polynomial size must be a power of two");
}
// TODO: add constructor with omega

polynomial_dfs(polynomial_dfs&& x)
BOOST_NOEXCEPT(std::is_nothrow_move_constructible<allocator_type>::value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ namespace boost {
return eval_is_zero(val.base_data());
}

// TODO: check returned value
template<class Backend, typename ModularParamsType>
BOOST_MP_CXX14_CONSTEXPR int eval_get_sign(const modular_adaptor<Backend, ModularParamsType> &) {
return 1;
Expand Down
1 change: 0 additions & 1 deletion libs/multiprecision/test/modular_adaptor_fixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ constexpr void pow_test(const boost::multiprecision::number<Backend, ExpressionT
BOOST_ASSERT_MSG(standard_number(a_m_powm_b.backend().convert_to_cpp_int()) == a_powm_b, "powm error");
}

// TODO: test_set is not ref because of constexpr error in gcc-10
// This test case uses normal boost::cpp_int for comparison to our modular_adaptor with cpp_int_modular_backend.
template<typename Number>
bool base_operations_test(std::array<Number, test_set_len> test_set) {
Expand Down

0 comments on commit 16f94a3

Please sign in to comment.