integrating c++17 fixes from #959 (ref:https://github.com/flann-lib/flann/pull/392), fixed pop_t error (b6e37553de)

This commit is contained in:
matlabbe
2023-03-16 17:48:40 -07:00
parent 6fe5e6375f
commit e3b7e9378d
9 changed files with 36 additions and 19 deletions

View File

@@ -477,6 +477,10 @@ struct HammingPopcnt
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
{
ResultType result = 0;
//for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
typedef unsigned long long pop_t;
#if __GNUC__
#if ANDROID && HAVE_NEON
static uint64_t features = android_getCpuFeatures();

View File

@@ -37,6 +37,7 @@
#include <cstring>
#include <stdarg.h>
#include <cmath>
#include <random>
#include "rtflann/general.h"
#include "rtflann/algorithms/nn_index.h"
@@ -677,7 +678,9 @@ protected:
/* Construct the randomized trees. */
for (int i = 0; i < trees_; i++) {
/* Randomize the order of vectors to allow for unbiased sampling. */
std::random_shuffle(ind.begin(), ind.end());
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(ind.begin(), ind.end(), g);
tree_roots_[i] = divideTree(&ind[0], int(size_) );
}
delete[] mean_;