Skip to content

Commit 5d8bf47

Browse files
committed
fix windows CI
MSVC doesn't accept unsigned index with pragma omp parallel for
1 parent 90349f2 commit 5d8bf47

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

faiss/utils/utils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <omp.h>
2929

3030
#include <algorithm>
31+
#include <type_traits>
3132
#include <vector>
3233

3334
#include <faiss/impl/AuxIndexStructures.h>
@@ -447,7 +448,8 @@ uint64_t bvec_checksum(size_t n, const uint8_t* a) {
447448

448449
void bvecs_checksum(size_t n, size_t d, const uint8_t* a, uint64_t* cs) {
449450
#pragma omp parallel for if (n > 1000)
450-
for (size_t i = 0; i < n; i++) {
451+
for (std::make_signed<std::size_t>::type i_ = 0; static_cast<std::size_t>(i_) < n; i_++) {
452+
const auto i = static_cast<std::size_t>(i_);
451453
cs[i] = bvec_checksum(d, a + i * d);
452454
}
453455
}

0 commit comments

Comments
 (0)