Commit 53fc0861 authored by biagio montesano's avatar biagio montesano

Deteted warning on hashing code

parent 29b6529c
......@@ -143,7 +143,7 @@ inline UINT64 next_set_of_n_elements( UINT64 x )
/* print code */
inline void print_code( UINT64 tmp, int b )
{
for ( int j = ( b - 1 ); j >= 0; j-- )
for ( long long int j = ( b - 1 ); j >= 0; j-- )
{
printf( "%llu", (long long int) tmp / ( 1 << j ) );
tmp = tmp - ( tmp / ( 1 << j ) ) * ( 1 << j );
......
......@@ -78,6 +78,7 @@ int main( int argc, char** argv )
if( imageMat.data == NULL )
{
std::cout << "Error, image could not be loaded. Please, check its path" << std::endl;
return -1;
}
/* create a random binary mask */
......
......@@ -85,7 +85,7 @@ void Array32::push( UINT32 Data )
{
if( arr[0] == arr[1] )
{
arr[1] = std::max( ceil( arr[1] * ARRAY_RESIZE_FACTOR ), arr[1] + ARRAY_RESIZE_ADD_FACTOR );
arr[1] = (UINT32) std::max( ceil( arr[1] * ARRAY_RESIZE_FACTOR ), arr[1] + ARRAY_RESIZE_ADD_FACTOR );
UINT32* new_Data = static_cast<UINT32*>( realloc( arr, sizeof(UINT32) * ( 2 + arr[1] ) ) );
if( new_Data == NULL )
{
......@@ -107,7 +107,7 @@ void Array32::push( UINT32 Data )
else
{
arr = (UINT32*) malloc( ( 2 + ARRAY_RESIZE_ADD_FACTOR ) * sizeof(UINT32) );
arr = (UINT32*) malloc( (size_t) ( 2 + ARRAY_RESIZE_ADD_FACTOR ) * sizeof(UINT32) );
arr[0] = 1;
arr[1] = 1;
arr[2] = Data;
......@@ -121,7 +121,7 @@ void Array32::insert( UINT32 index, UINT32 Data )
{
if( arr[0] == arr[1] )
{
arr[1] = ceil( arr[0] * 1.1 );
arr[1] = (UINT32) ceil( arr[0] * 1.1 );
UINT32* new_data = static_cast<UINT32*>( realloc( arr, sizeof(UINT32) * ( 2 + arr[1] ) ) );
if( new_data == NULL )
{
......
......@@ -86,7 +86,7 @@ void Mihasher::query( UINT32* results, UINT32* numres, UINT8 * Query, UINT64 *ch
{
/* if K == 0 that means we want everything to be processed.
So maxres = N in that case. Otherwise K limits the results processed */
UINT32 maxres = K ? K : N;
UINT32 maxres = K ? K : (UINT32) N;
/* number of results so far obtained (up to a distance of s per chunk) */
UINT32 n = 0;
......@@ -142,7 +142,8 @@ void Mihasher::query( UINT32* results, UINT32* numres, UINT8 * Query, UINT64 *ch
it touches another one */
/* the loop for changing bitstr */
while ( true )
bool infiniteWhile = true;
while ( infiniteWhile )
{
if( bit != -1 )
{
......@@ -207,12 +208,12 @@ Mihasher::Mihasher( int _B, int _m )
B = _B;
B_over_8 = B / 8;
m = _m;
b = ceil( (double) B / m );
b = (int) ceil( (double) B / m );
/* assuming that B/2 is large enough radius to include
all of the k nearest neighbors */
D = ceil( B / 2.0 );
d = ceil( (double) D / m );
D = (int) ceil( B / 2.0 );
d = (int) ceil( (double) D / m );
/* mplus is the number of chunks with b bits
(m-mplus) is the number of chunks with (b-1) bits */
......@@ -221,7 +222,7 @@ Mihasher::Mihasher( int _B, int _m )
xornum = new UINT32[d + 2];
xornum[0] = 0;
for ( int i = 0; i <= d; i++ )
xornum[i + 1] = xornum[i] + choose( b, i );
xornum[i + 1] = xornum[i] + (UINT32) choose( b, i );
H = new SparseHashtable[m];
......@@ -258,7 +259,7 @@ void Mihasher::populate( cv::Mat & _codes, UINT32 _N, int dim1codes )
split( chunks, pcodes, m, mplus, b );
for ( int k = 0; k < m; k++ )
H[k].insert( chunks[k], i );
H[k].insert( chunks[k], (UINT32) i );
if( i % (int) ceil( N / 1000.0 ) == 0 )
fflush( stdout );
......
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