From 509b87f103c66f46f3cc86b85431b02a9c2eb801 Mon Sep 17 00:00:00 2001 From: Gracieeea <50101579+Gracieeea@users.noreply.github.com> Date: Mon, 27 Apr 2020 12:52:11 +0800 Subject: [PATCH] replace int with size_t (#2140) Signed-off-by: Gracieeea --- core/src/index/thirdparty/hnswlib/bruteforce.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/index/thirdparty/hnswlib/bruteforce.h b/core/src/index/thirdparty/hnswlib/bruteforce.h index 3f20856a54..ae2fa6a8f6 100644 --- a/core/src/index/thirdparty/hnswlib/bruteforce.h +++ b/core/src/index/thirdparty/hnswlib/bruteforce.h @@ -46,7 +46,7 @@ class BruteforceSearch : public AlgorithmInterface { void addPoint(const void *datapoint, labeltype label) { - int idx; + size_t idx; { std::unique_lock lock(index_lock); @@ -90,13 +90,13 @@ class BruteforceSearch : public AlgorithmInterface { searchKnn(const void *query_data, size_t k) const { std::priority_queue> topResults; if (cur_element_count == 0) return topResults; - for (int i = 0; i < k; i++) { + for (size_t i = 0; i < k; i++) { dist_t dist = fstdistfunc_(query_data, data_ + size_per_element_ * i, dist_func_param_); topResults.push(std::pair(dist, *((labeltype *) (data_ + size_per_element_ * i + data_size_)))); } dist_t lastdist = topResults.top().first; - for (int i = k; i < cur_element_count; i++) { + for (size_t i = k; i < cur_element_count; i++) { dist_t dist = fstdistfunc_(query_data, data_ + size_per_element_ * i, dist_func_param_); if (dist <= lastdist) { topResults.push(std::pair(dist, *((labeltype *) (data_ + size_per_element_ * i +