mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 21:58:08 +00:00
Fix LruCache when next_score overflows
This commit is contained in:
parent
4a7194d2df
commit
8b5d9d33ab
@ -114,9 +114,9 @@ void LruCache<TKey, TValue>::IncrementScore() {
|
|||||||
// Overflow.
|
// Overflow.
|
||||||
if (next_score_ == 0) {
|
if (next_score_ == 0) {
|
||||||
std::sort(entries_.begin(), entries_.end(), [](const Entry& a, const Entry& b) {
|
std::sort(entries_.begin(), entries_.end(), [](const Entry& a, const Entry& b) {
|
||||||
return a.score > b.score;
|
return a.score < b.score;
|
||||||
});
|
});
|
||||||
for (Entry& entry : entries_)
|
for (Entry& entry : entries_)
|
||||||
entry.score = next_score_++;
|
entry.score = next_score_++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user