From 14bce62cc4edd71a1d67d81ee3d257a906884d21 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Tue, 4 Jan 2022 15:34:34 +0800 Subject: [PATCH] fix building --- src/Common/LRUResourceCache.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Common/LRUResourceCache.h b/src/Common/LRUResourceCache.h index 449ad56ac8b..40c283749d3 100644 --- a/src/Common/LRUResourceCache.h +++ b/src/Common/LRUResourceCache.h @@ -330,11 +330,12 @@ private: // key mustn't be in the cache Cell * set(const Key & insert_key, MappedPtr value) { - auto weight = value ? weight_function(*value) : 0; - auto queue_size = cells.size() + 1; - auto loss_weight = 0; - auto is_overflow = [&] { - return current_weight + weight - loss_weight > max_weight || (max_element_size != 0 && queue_size > max_element_size); + size_t weight = value ? weight_function(*value) : 0; + size_t queue_size = cells.size() + 1; + size_t loss_weight = 0; + auto is_overflow = [&] + { + return current_weight + weight > max_weight + loss_weight || (max_element_size != 0 && queue_size > max_element_size); }; auto key_it = queue.begin(); @@ -355,7 +356,7 @@ private: if (cell.reference_count == 0) { loss_weight += cell.weight; - queue_size -= 1; + queue_size--; to_release_keys.insert(key); }