Skip to content

Commit a36b73e

Browse files
committed
Apply clang-tidy fixes for modernize-loop-convert in Barvinok.cpp (NFC)
1 parent 90e9e96 commit a36b73e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mlir/lib/Analysis/Presburger/Barvinok.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,10 @@ void normalizeDenominatorExponents(int &sign, QuasiPolynomial &num,
613613
// denominator, and convert them to their absolute values.
614614
unsigned numNegExps = 0;
615615
Fraction sumNegExps(0, 1);
616-
for (unsigned j = 0, e = dens.size(); j < e; ++j) {
617-
if (dens[j] < 0) {
616+
for (const auto &den : dens) {
617+
if (den < 0) {
618618
numNegExps += 1;
619-
sumNegExps += dens[j];
619+
sumNegExps += den;
620620
}
621621
}
622622

@@ -722,8 +722,8 @@ mlir::presburger::detail::computeNumTerms(const GeneratingFunction &gf) {
722722
// Then, using the formula for geometric series, we replace each (1 -
723723
// (s+1)^(dens[j])) with
724724
// (-s)(\sum_{0 ≤ k < dens[j]} (s+1)^k).
725-
for (unsigned j = 0, e = dens.size(); j < e; ++j)
726-
dens[j] = abs(dens[j]) - 1;
725+
for (auto &j : dens)
726+
j = abs(j) - 1;
727727
// Note that at this point, the semantics of `dens[j]` changes to mean
728728
// a term (\sum_{0 ≤ k ≤ dens[j]} (s+1)^k). The denominator is, as before,
729729
// a product of these terms.

0 commit comments

Comments
 (0)