File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
modules/flann/include/opencv2/flann Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,7 @@ struct Hamming2
506
506
const uint64_t * pa = reinterpret_cast <const uint64_t *>(a);
507
507
const uint64_t * pb = reinterpret_cast <const uint64_t *>(b);
508
508
ResultType result = 0 ;
509
- size /= ( sizeof ( uint64_t )/ sizeof ( unsigned char )) ;
509
+ size /= long_word_size_ ;
510
510
for (size_t i = 0 ; i < size; ++i ) {
511
511
result += popcnt64 (*pa ^ *pb);
512
512
++pa;
@@ -516,7 +516,7 @@ struct Hamming2
516
516
const uint32_t * pa = reinterpret_cast <const uint32_t *>(a);
517
517
const uint32_t * pb = reinterpret_cast <const uint32_t *>(b);
518
518
ResultType result = 0 ;
519
- size /= ( sizeof ( uint32_t )/ sizeof ( unsigned char )) ;
519
+ size /= long_word_size_ ;
520
520
for (size_t i = 0 ; i < size; ++i ) {
521
521
result += popcnt32 (*pa ^ *pb);
522
522
++pa;
@@ -525,6 +525,13 @@ struct Hamming2
525
525
#endif
526
526
return result;
527
527
}
528
+
529
+ private:
530
+ #ifdef FLANN_PLATFORM_64_BIT
531
+ static const size_t long_word_size_ = sizeof (uint64_t )/sizeof (unsigned char );
532
+ #else
533
+ static const size_t long_word_size_ = sizeof (uint32_t )/sizeof (unsigned char );
534
+ #endif
528
535
};
529
536
530
537
You can’t perform that action at this time.
0 commit comments