Skip to content

Commit f9ffdf2

Browse files
Fix lambda capture
1 parent 55772ad commit f9ffdf2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

FindAFactor/_find_a_factor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ inline BigInteger modExp(BigInteger base, BigInteger exp, const BigInteger &mod)
723723

724724
// Perform Gaussian elimination on a binary matrix
725725
void gaussianElimination(std::map<BigInteger, boost::dynamic_bitset<size_t>> *matrix) {
726+
const unsigned cpuCount = CpuCount;
726727
const auto mBegin = matrix->begin();
727728
const size_t rows = matrix->size();
728729
const size_t cols = mBegin->second.size();
@@ -750,16 +751,16 @@ void gaussianElimination(std::map<BigInteger, boost::dynamic_bitset<size_t>> *ma
750751
if (cpu >= rows) {
751752
break;
752753
}
753-
dispatch.dispatch([col, cpu, CpuCount, &rows, &c, &mBegin]() {
754+
dispatch.dispatch([col, cpu, &cpuCount, &rows, &c, &mBegin]() {
754755
auto rowIt = mBegin;
755756
std::advance(rowIt, cpu);
756-
for (size_t row = cpu; row < rows; row += CpuCount) {
757+
for (size_t row = cpu; row < rows; row += cpuCount) {
757758
boost::dynamic_bitset<size_t> &r = rowIt->second;
758759
if ((row != col) && r[col]) {
759760
r ^= c;
760761
}
761-
if ((row + CpuCount) < rows) {
762-
std::advance(rowIt, CpuCount);
762+
if ((row + cpuCount) < rows) {
763+
std::advance(rowIt, cpuCount);
763764
}
764765
}
765766

0 commit comments

Comments
 (0)