File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1022,7 +1022,10 @@ namespace ack {
10221022 constexpr bool operator ()(bigint& z, const bigint& x, const bigint& y) const
10231023 {
10241024 bool success = bigint::mul (z, x, y);
1025- return success && bigint::mod (z, z, *pm);
1025+ bigint u;
1026+ success = success && bigint::mod (u, z, *pm);
1027+ z = std::move ( u );
1028+ return success;
10261029 }
10271030 };
10281031
@@ -1031,7 +1034,9 @@ namespace ack {
10311034 constexpr bool operator ()(bigint& y, const bigint& x) const
10321035 {
10331036 bool success = bigint::sqr (y, x);
1034- success = success && bigint::mod (y, y, *pm);
1037+ bigint u; // storing result in temp var avoids pointer aliasing
1038+ success = success && bigint::mod (u, y, *pm);
1039+ y = std::move ( u );
10351040 return success;
10361041 }
10371042 };
You can’t perform that action at this time.
0 commit comments