Skip to content

Commit c2d2e47

Browse files
committed
Merge pull request flann-lib#246 from dm-jrae/master
result_set bugfix
2 parents fbe5a3b + fb7588c commit c2d2e47

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

COPYING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ The BSD License
33

44
Copyright (c) 2008-2011 Marius Muja ([email protected]). All rights reserved.
55
Copyright (c) 2008-2011 David G. Lowe ([email protected]). All rights reserved.
6+
Copyright (c) 2015 Google Inc (Jack Rae, [email protected]). All Rights Reserved.
67

78
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
89

src/cpp/flann/util/result_set.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,10 @@ class KNNResultSet : public ResultSet<DistanceType>
252252
#endif
253253
{
254254
// Check for duplicate indices
255-
size_t j = i - 1;
256-
while (dist_index_[j].dist_ == dist) {
255+
for (size_t j = i - 1; dist_index_[j].dist_ == dist && j--;) {
257256
if (dist_index_[j].index_ == index) {
258257
return;
259258
}
260-
--j;
261259
}
262260
break;
263261
}

0 commit comments

Comments
 (0)