Add debug assert to check in FLANN the vectors size is multiple of the architecture word size

pull/18085/head
Pierre-Emmanuel Viel 4 years ago
parent f3cebb3e1b
commit 3f55152ca0
  1. 4
      modules/flann/include/opencv2/flann/dist.h

@ -683,6 +683,8 @@ struct Hamming2
template <typename Iterator1, typename Iterator2>
ResultType operator()(const Iterator1 a, const Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
{
CV_DbgAssert(!(size % long_word_size_) && "vectors size must be multiple of long words size (i.e. 8)");
#ifdef FLANN_PLATFORM_64_BIT
const uint64_t* pa = reinterpret_cast<const uint64_t*>(a);
const uint64_t* pb = reinterpret_cast<const uint64_t*>(b);
@ -711,6 +713,8 @@ struct Hamming2
template <typename Iterator1>
ResultType operator()(const Iterator1 a, ZeroIterator<unsigned char> b, size_t size, ResultType /*worst_dist*/ = -1) const
{
CV_DbgAssert(!(size % long_word_size_) && "vectors size must be multiple of long words size (i.e. 8)");
(void)b;
#ifdef FLANN_PLATFORM_64_BIT
const uint64_t* pa = reinterpret_cast<const uint64_t*>(a);

Loading…
Cancel
Save