cnpy warns fix

pull/265/head
Vitaliy Lyudvichenko 10 years ago
parent dd15521860
commit c1f44104d0
  1. 14
      modules/dnn/test/cnpy.cpp
  2. 2
      modules/dnn/test/cnpy.h

@ -9,9 +9,19 @@
#include<cstring> #include<cstring>
#include<iomanip> #include<iomanip>
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
char cnpy::BigEndianTest() { char cnpy::BigEndianTest() {
unsigned char x[] = {1,0}; union
short y = *(short*) x; {
unsigned char x[2];
short y;
};
x[0] = 1;
x[1] = 0;
return y == 1 ? '<' : '>'; return y == 1 ? '<' : '>';
} }

@ -150,7 +150,7 @@ namespace cnpy {
std::vector<char> npy_header = create_npy_header(data,shape,ndims); std::vector<char> npy_header = create_npy_header(data,shape,ndims);
unsigned long nels = 1; unsigned long nels = 1;
for (int m=0; m<ndims; m++ ) nels *= shape[m]; for (unsigned m=0; m<ndims; m++ ) nels *= shape[m];
int nbytes = nels*sizeof(T) + npy_header.size(); int nbytes = nels*sizeof(T) + npy_header.size();
//get the CRC of the data to be added //get the CRC of the data to be added

Loading…
Cancel
Save