Skip to content

Commit 58c215d

Browse files
Nit: fix variable types (#231)
Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com>
1 parent 0c7cef9 commit 58c215d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

thirdparty/faiss/faiss/impl/pq4_fast_scan_search_1.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void accumulate_fixed_blocks(
125125
ResultHandler& res,
126126
const Scaler& scaler) {
127127
constexpr int bbs = 32 * BB;
128-
for (int64_t j0 = 0; j0 < nb; j0 += bbs) {
128+
for (size_t j0 = 0; j0 < nb; j0 += bbs) {
129129
FixedStorageHandler<NQ, 2 * BB> res2;
130130
kernel_accumulate_block<NQ, BB>(nsq, codes, LUT, res2, scaler);
131131
res.set_block_origin(0, j0);

thirdparty/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ void accumulate_q_4step(
123123
constexpr int Q4 = (QBS >> 12) & 15;
124124
constexpr int SQ = Q1 + Q2 + Q3 + Q4;
125125

126-
for (int64_t j0 = 0; j0 < ntotal2; j0 += 32, codes += 32 * nsq / 2) {
126+
for (size_t j0 = 0; j0 < ntotal2; j0 += 32, codes += 32 * nsq / 2) {
127127
res.set_block_origin(0, j0);
128128

129129
// skip computing distances if all vectors inside a block are filtered out
130130
if (res.sel != nullptr) { // we have filter here
131131
bool skip_flag = true;
132-
for (int64_t jj = 0; jj < std::min<int64_t>(32, ntotal2 - j0);
132+
for (size_t jj = 0; jj < std::min<size_t>(32, ntotal2 - j0);
133133
jj++) {
134134
auto real_idx = res.adjust_id(0, jj);
135135
if (res.sel->is_member(real_idx)) { // id is not filtered out, can not skip computing
@@ -173,7 +173,7 @@ void kernel_accumulate_block_loop(
173173
const uint8_t* LUT,
174174
ResultHandler& res,
175175
const Scaler& scaler) {
176-
for (int64_t j0 = 0; j0 < ntotal2; j0 += 32) {
176+
for (size_t j0 = 0; j0 < ntotal2; j0 += 32) {
177177
res.set_block_origin(0, j0);
178178
kernel_accumulate_block<NQ, ResultHandler>(
179179
nsq, codes + j0 * nsq / 2, LUT, res, scaler);
@@ -260,7 +260,7 @@ void pq4_accumulate_loop_qbs(
260260

261261
// default implementation where qbs is not known at compile time
262262

263-
for (int64_t j0 = 0; j0 < ntotal2; j0 += 32) {
263+
for (size_t j0 = 0; j0 < ntotal2; j0 += 32) {
264264
const uint8_t* LUT = LUT0;
265265
int qi = qbs;
266266
int i0 = 0;

thirdparty/faiss/faiss/utils/partitioning_avx2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void count_lt_and_eq(
8484
n_lt += 16 - i_ge;
8585
}
8686

87-
for (size_t i = n1 * 16; i < n; i++) {
87+
for (size_t i = n1 * 16; i < (size_t)n; i++) {
8888
uint16_t v = *vals++;
8989
if (C::cmp(thresh, v)) {
9090
n_lt++;
@@ -162,7 +162,7 @@ int simd_compress_array(
162162
}
163163

164164
// end with scalar
165-
for (int i = (n & ~15); i < n; i++) {
165+
for (size_t i = (n & ~15); i < n; i++) {
166166
if (C::cmp(thresh, vals[i])) {
167167
vals[wp] = vals[i];
168168
ids[wp] = ids[i];

0 commit comments

Comments
 (0)