From 36319c91ab34930f6b8aa5316c67c23b82b4b19c Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Mon, 30 Jan 2017 13:38:36 +0100 Subject: [PATCH] get rid of int/uint comparison warnings --- bfps/cpp/field.cpp | 12 ++++++------ bfps/cpp/field.hpp | 4 ++-- bfps/cpp/kspace.cpp | 2 +- bfps/cpp/rFFTW_distributed_particles.cpp | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bfps/cpp/field.cpp b/bfps/cpp/field.cpp index 2c043699..b4b8f3ea 100644 --- a/bfps/cpp/field.cpp +++ b/bfps/cpp/field.cpp @@ -302,7 +302,7 @@ int field<rnumber, be, fc>::io( /* check file space */ int ndims_fspace = H5Sget_simple_extent_dims(fspace, dims, NULL); - assert(ndims_fspace == ndim(fc)); + assert(((unsigned int)(ndims_fspace)) == ndim(fc)); if (this->real_space_representation) { for (unsigned int i=0; i<ndim(fc); i++) @@ -488,7 +488,7 @@ int field<rnumber, be, fc>::io_database( /* check file space */ int ndims_fspace = H5Sget_simple_extent_dims(fspace, dims, NULL); - assert(ndims_fspace == ndim(fc) + 1); + assert(ndims_fspace == int(ndim(fc) + 1)); offset[0] = toffset; if (this->real_space_representation) { @@ -790,7 +790,7 @@ void field<rnumber, be, fc>::symmetrize() { for (cc = 0; cc < ncomp(fc); cc++) data[cc][1] = 0.0; - for (ii = 1; ii < this->clayout->sizes[1]/2; ii++) + for (ii = 1; ii < ptrdiff_t(this->clayout->sizes[1]/2); ii++) for (cc = 0; cc < ncomp(fc); cc++) { ( *(data + cc + ncomp(fc)*(this->clayout->sizes[1] - ii)*this->clayout->sizes[2]))[0] = (*(data + cc + ncomp(fc)*( ii)*this->clayout->sizes[2]))[0]; @@ -803,11 +803,11 @@ void field<rnumber, be, fc>::symmetrize() ptrdiff_t yy; /*ptrdiff_t tindex;*/ int ranksrc, rankdst; - for (yy = 1; yy < this->clayout->sizes[0]/2; yy++) { + for (yy = 1; yy < ptrdiff_t(this->clayout->sizes[0]/2); yy++) { ranksrc = this->clayout->rank[0][yy]; rankdst = this->clayout->rank[0][this->clayout->sizes[0] - yy]; if (this->clayout->myrank == ranksrc) - for (ii = 0; ii < this->clayout->sizes[1]; ii++) + for (ii = 0; ii < ptrdiff_t(this->clayout->sizes[1]); ii++) for (cc = 0; cc < ncomp(fc); cc++) for (int imag_comp=0; imag_comp<2; imag_comp++) (*(buffer + ncomp(fc)*ii+cc))[imag_comp] = @@ -825,7 +825,7 @@ void field<rnumber, be, fc>::symmetrize() } if (this->clayout->myrank == rankdst) { - for (ii = 1; ii < this->clayout->sizes[1]; ii++) + for (ii = 1; ii < ptrdiff_t(this->clayout->sizes[1]); ii++) for (cc = 0; cc < ncomp(fc); cc++) { (*(data + ncomp(fc)*((this->clayout->sizes[0] - yy - this->clayout->starts[0])*this->clayout->sizes[1] + ii)*this->clayout->sizes[2] + cc))[0] = diff --git a/bfps/cpp/field.hpp b/bfps/cpp/field.hpp index 066130a4..7657d2c4 100644 --- a/bfps/cpp/field.hpp +++ b/bfps/cpp/field.hpp @@ -116,10 +116,10 @@ class field return (typename fftw_interface<rnumber>::complex*__restrict__)this->data; } - inline rnumber &rval(ptrdiff_t rindex, int component = 0) + inline rnumber &rval(ptrdiff_t rindex, unsigned int component = 0) { assert(fc == ONE || fc == THREE); - assert(component >= 0 && component <ncomp(fc)); + assert(component >= 0 && component < ncomp(fc)); return *(this->data + rindex*ncomp(fc) + component); } diff --git a/bfps/cpp/kspace.cpp b/bfps/cpp/kspace.cpp index f98024ea..01afda70 100644 --- a/bfps/cpp/kspace.cpp +++ b/bfps/cpp/kspace.cpp @@ -188,7 +188,7 @@ void kspace<be, dt>::dealias(typename fftw_interface<rnumber>::complex *__restri ptrdiff_t zindex, double k2){ double tval = this->dealias_filter[int(round(k2 / this->dk2))]; - for (int tcounter=0; tcounter<2*ncomp(fc); tcounter++) + for (unsigned int tcounter=0; tcounter<2*ncomp(fc); tcounter++) ((rnumber*)a)[2*ncomp(fc)*cindex + tcounter] *= tval; }); break; diff --git a/bfps/cpp/rFFTW_distributed_particles.cpp b/bfps/cpp/rFFTW_distributed_particles.cpp index 713b4f79..e5a539ab 100644 --- a/bfps/cpp/rFFTW_distributed_particles.cpp +++ b/bfps/cpp/rFFTW_distributed_particles.cpp @@ -657,8 +657,8 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri for (int s = -1; s <= 0; s++) for (auto &pp: this->domain_particles[s]) { - if (pp >= cindex*this->chunk_size && - pp < (cindex+1)*this->chunk_size) + if (pp >= int(cindex*this->chunk_size) && + pp < int((cindex+1)*this->chunk_size)) { std::copy(y[pp].data, y[pp].data + 3, @@ -711,8 +711,8 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri for (int s = -1; s <= 0; s++) for (auto &pp: this->domain_particles[s]) { - if (pp >= cindex*this->chunk_size && - pp < (cindex+1)*this->chunk_size) + if (pp >= int(cindex*this->chunk_size) && + pp < int((cindex+1)*this->chunk_size)) { std::copy(this->state[pp].data, this->state[pp].data + state_dimension(particle_type), @@ -754,8 +754,8 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri for (int s = -1; s <= 0; s++) for (auto &pp: this->domain_particles[s]) { - if (pp >= cindex*this->chunk_size && - pp < (cindex+1)*this->chunk_size) + if (pp >= int(cindex*this->chunk_size) && + pp < int((cindex+1)*this->chunk_size)) { std::copy(this->rhs[i][pp].data, this->rhs[i][pp].data + state_dimension(particle_type), -- GitLab