stl'ed another.

This commit is contained in:
G.E 2024-05-18 00:02:43 +03:00
parent 97a8519084
commit fa358535be

View File

@ -135,10 +135,10 @@ void FDRCompiler::createInitialState(FDR *fdr) {
// Find the minimum length for the literals in this bucket. // Find the minimum length for the literals in this bucket.
const vector<LiteralIndex> &bucket_lits = bucketToLits[b]; const vector<LiteralIndex> &bucket_lits = bucketToLits[b];
u32 min_len = ~0U; u32 min_len = ~0U;
for (const LiteralIndex &lit_idx : bucket_lits) { auto mlit = [lits=lits](const LiteralIndex &m, const LiteralIndex &n) {
// cppcheck-suppress useStlAlgorithm return verify_u32(lits[m].s.length()) < verify_u32(lits[n].s.length()); };
min_len = min(min_len, verify_u32(lits[lit_idx].s.length())); auto minel = std::min_element(bucket_lits.begin(), bucket_lits.end(), mlit);
} min_len = min(min_len, verify_u32(lits[*minel].s.length()));
DEBUG_PRINTF("bucket %u has min_len=%u\n", b, min_len); DEBUG_PRINTF("bucket %u has min_len=%u\n", b, min_len);
assert(min_len); assert(min_len);