diff --git a/src/rime/algo/syllabifier.cc b/src/rime/algo/syllabifier.cc index c146854492..718d48d432 100644 --- a/src/rime/algo/syllabifier.cc +++ b/src/rime/algo/syllabifier.cc @@ -113,7 +113,7 @@ int Syllabifier::BuildSyllableGraph(const string &input, if (it == spellings.end()) { spellings.insert({syllable_id, props}); } else { - it->second.type = std::min(it->second.type, props.type); + it->second.type = (std::min)(it->second.type, props.type); } // let end_vertex_type be the best (smaller) type of spelling // that ends at the vertex diff --git a/src/rime/dict/corrector.cc b/src/rime/dict/corrector.cc index bb2bbadef7..590fb22b50 100644 --- a/src/rime/dict/corrector.cc +++ b/src/rime/dict/corrector.cc @@ -172,7 +172,7 @@ Distance EditDistanceCorrector::LevenshteinDistance(const std::string &s1, const last_diagonal + SubstCost(s1[y - 1], s2[x - 1]) }; - column[y] = std::min(possibilities); + column[y] = (std::min)(possibilities); last_diagonal = old_diagonal; } } @@ -199,15 +199,15 @@ Distance EditDistanceCorrector::RestrictedDistance(const std::string& s1, for(size_t i = 1; i <= len1; ++i) { auto min_d = threshold + 1; for(size_t j = 1; j <= len2; ++j) { - d[index(i, j)] = std::min({ + d[index(i, j)] = (std::min)({ d[index(i - 1, j)] + 2, d[index(i, j - 1)] + 2, d[index(i - 1, j - 1)] + SubstCost(s1[i - 1], s2[j - 1]) }); if (i > 1 && j > 1 && s1[i - 2] == s2[j - 1] && s1[i - 1] == s2[j - 2]) { - d[index(i, j)] = std::min(d[index(i, j)], d[index(i - 2, j - 2)] + 2); + d[index(i, j)] = (std::min)(d[index(i, j)], d[index(i - 2, j - 2)] + 2); } - min_d = std::min(min_d, d[index(i, j)]); + min_d = (std::min)(min_d, d[index(i, j)]); } // early termination: do not continue if too far if (min_d > threshold)