@@ -73,11 +73,11 @@ namespace nil {
73
73
polynomial_dfs () : val(1 , FieldValueType::zero()), _d(0 ) {
74
74
}
75
75
76
- explicit polynomial_dfs (size_t d, size_type n) : val(n), _d(d) {
76
+ explicit polynomial_dfs (size_t d, size_type n) : val(n, FieldValueType::zero() ), _d(d) {
77
77
BOOST_ASSERT_MSG (n == detail::power_of_two (n), " DFS optimal polynomial size must be a power of two" );
78
78
}
79
79
80
- explicit polynomial_dfs (size_t d, size_type n, const allocator_type& a) : val(n, a), _d(d) {
80
+ explicit polynomial_dfs (size_t d, size_type n, const allocator_type& a) : val(n, FieldValueType::zero(), a), _d(d) {
81
81
BOOST_ASSERT_MSG (n == detail::power_of_two (n), " DFS optimal polynomial size must be a power of two" );
82
82
}
83
83
@@ -340,6 +340,7 @@ namespace nil {
340
340
return ;
341
341
}
342
342
BOOST_ASSERT_MSG (_sz >= _d, " Resizing DFS polynomial to a size less than degree is prohibited: can't restore the polynomial in the future." );
343
+
343
344
if (this ->degree () == 0 ) {
344
345
// Here we cannot write this->val.resize(_sz, this->val[0]), it will segfault.
345
346
auto value = this ->val [0 ];
@@ -436,6 +437,7 @@ namespace nil {
436
437
this ->resize (other.size ());
437
438
}
438
439
this ->_d = std::max (this ->_d , other._d );
440
+
439
441
if (this ->size () > other.size ()) {
440
442
polynomial_dfs tmp (other);
441
443
tmp.resize (this ->size ());
@@ -512,7 +514,6 @@ namespace nil {
512
514
polynomial_dfs operator *(const polynomial_dfs& other) const {
513
515
polynomial_dfs result = *this ;
514
516
result *= other;
515
-
516
517
return result;
517
518
}
518
519
@@ -711,7 +712,7 @@ namespace nil {
711
712
polynomial_dfs<FieldValueType, Allocator> operator *(const polynomial_dfs<FieldValueType, Allocator>& A,
712
713
const FieldValueType& B) {
713
714
polynomial_dfs<FieldValueType> result (A);
714
- for ( auto it = result.begin (); it != result.end (); it++ ) {
715
+ for ( auto it = result.begin (); it != result.end (); ++it) {
715
716
*it *= B;
716
717
}
717
718
return result;
@@ -731,7 +732,7 @@ namespace nil {
731
732
const FieldValueType& B) {
732
733
polynomial_dfs<FieldValueType> result (A);
733
734
FieldValueType B_inversed = B.inversed ();
734
- for ( auto it = result.begin (); it != result.end (); it++ ) {
735
+ for ( auto it = result.begin (); it != result.end (); ++it) {
735
736
*it *= B_inversed;
736
737
}
737
738
return result;
0 commit comments