@@ -22,6 +22,8 @@ class KdTree : public pico_tree::KdTree<Space_, Metric_> {
22
22
23
23
using Base = pico_tree::KdTree<Space_, Metric_>;
24
24
using Space = Space_;
25
+ // TODO Remove when MSVC++ has default support for OpenMP 3.0+.
26
+ using SSize = std::ptrdiff_t ;
25
27
26
28
public:
27
29
using Base::Dim;
@@ -47,7 +49,7 @@ class KdTree : public pico_tree::KdTree<Space_, Metric_> {
47
49
auto output = static_cast <NeighborType*>(nns.mutable_data ());
48
50
49
51
#pragma omp parallel for schedule(dynamic, kChunkSize)
50
- for (SizeType i = 0 ; i < query.size (); ++i) {
52
+ for (SSize i = 0 ; i < static_cast <SSize>( query.size () ); ++i) {
51
53
Base::SearchKnn (query[i], output + i * k, output + (i + 1 ) * k);
52
54
}
53
55
}
@@ -69,7 +71,7 @@ class KdTree : public pico_tree::KdTree<Space_, Metric_> {
69
71
auto output = static_cast <NeighborType*>(nns.mutable_data ());
70
72
71
73
#pragma omp parallel for schedule(dynamic, kChunkSize)
72
- for (SizeType i = 0 ; i < query.size (); ++i) {
74
+ for (SSize i = 0 ; i < static_cast <SSize>( query.size () ); ++i) {
73
75
Base::SearchKnn (query[i], e, output + i * k, output + (i + 1 ) * k);
74
76
}
75
77
}
@@ -95,7 +97,7 @@ class KdTree : public pico_tree::KdTree<Space_, Metric_> {
95
97
96
98
#pragma omp parallel for schedule(dynamic, kChunkSize)
97
99
// TODO Reduce the vector resize overhead
98
- for (SizeType i = 0 ; i < query.size (); ++i) {
100
+ for (SSize i = 0 ; i < static_cast <SSize>( query.size () ); ++i) {
99
101
Base::SearchRadius (query[i], radius, nns_data[i], sort);
100
102
}
101
103
}
@@ -125,7 +127,7 @@ class KdTree : public pico_tree::KdTree<Space_, Metric_> {
125
127
126
128
#pragma omp parallel for schedule(dynamic, kChunkSize)
127
129
// TODO Reduce the vector resize overhead
128
- for (SizeType i = 0 ; i < query_min.size (); ++i) {
130
+ for (SSize i = 0 ; i < static_cast <SSize>( query_min.size () ); ++i) {
129
131
Base::SearchBox (query_min[i], query_max[i], box_data[i]);
130
132
}
131
133
}
0 commit comments