Commit 24cb30fe authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed errors and warnings when building with MSVC

parent 3b2d4b57
...@@ -34,7 +34,12 @@ ...@@ -34,7 +34,12 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include <string.h> #include <string.h>
#ifdef _MSC_VER
typedef unsigned uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h> #include <stdint.h>
#endif
#include "defines.h" #include "defines.h"
...@@ -150,10 +155,10 @@ struct L2 ...@@ -150,10 +155,10 @@ struct L2
/* Process 4 items with each loop for efficiency. */ /* Process 4 items with each loop for efficiency. */
while (a < lastgroup) { while (a < lastgroup) {
diff0 = a[0] - b[0]; diff0 = (ResultType)(a[0] - b[0]);
diff1 = a[1] - b[1]; diff1 = (ResultType)(a[1] - b[1]);
diff2 = a[2] - b[2]; diff2 = (ResultType)(a[2] - b[2]);
diff3 = a[3] - b[3]; diff3 = (ResultType)(a[3] - b[3]);
result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3; result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
a += 4; a += 4;
b += 4; b += 4;
......
...@@ -138,7 +138,7 @@ public: ...@@ -138,7 +138,7 @@ public:
*/ */
bool test(size_t index) const bool test(size_t index) const
{ {
return (bool)(bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))); return (bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))) != 0;
} }
private: private:
......
...@@ -57,7 +57,7 @@ namespace cvflann ...@@ -57,7 +57,7 @@ namespace cvflann
FLANN_DEPRECATED inline void set_distance_type(flann_distance_t distance_type, int order = 0) FLANN_DEPRECATED inline void set_distance_type(flann_distance_t distance_type, int order = 0)
{ {
flann_distance_type_() = distance_type; flann_distance_type_() = (flann_distance_t)((size_t)distance_type + order*0);
} }
} }
......
...@@ -224,7 +224,7 @@ private: ...@@ -224,7 +224,7 @@ private:
// Repeat several trials // Repeat several trials
double bestNewPot = -1; double bestNewPot = -1;
int bestNewIndex; int bestNewIndex = 0;
for (int localTrial = 0; localTrial < numLocalTries; localTrial++) { for (int localTrial = 0; localTrial < numLocalTries; localTrial++) {
// Choose our center - have to be slightly careful to return a valid answer even accounting // Choose our center - have to be slightly careful to return a valid answer even accounting
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <map> #include <map>
#endif #endif
#include <math.h> #include <math.h>
#include <stdint.h> #include <stddef.h>
#include "dynamic_bitset.h" #include "dynamic_bitset.h"
#include "matrix.h" #include "matrix.h"
...@@ -385,7 +385,7 @@ inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) cons ...@@ -385,7 +385,7 @@ inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) cons
size_t mask_block = *pmask_block; size_t mask_block = *pmask_block;
while (mask_block) { while (mask_block) {
// Get the lowest set bit in the mask block // Get the lowest set bit in the mask block
size_t lowest_bit = mask_block & (-mask_block); size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block);
// Add it to the current subsignature if necessary // Add it to the current subsignature if necessary
subsignature += (feature_block & lowest_bit) ? bit_index : 0; subsignature += (feature_block & lowest_bit) ? bit_index : 0;
// Reset the bit in the mask block // Reset the bit in the mask block
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment