Added some explicit casts in get_neighbor (MPI) to fix warnings raised when compiling with older gcc

This commit is contained in:
jpekkila
2019-11-20 10:18:10 +02:00
parent d3260edd2a
commit 0b0ccd697a

View File

@@ -799,7 +799,7 @@ mod(const int a, const int b)
return r < 0 ? r + b : r; return r < 0 ? r + b : r;
} }
static int static inline int
get_neighbor(const int3 offset) get_neighbor(const int3 offset)
{ {
// The number of nodes is n^3 = m = num_processes // The number of nodes is n^3 = m = num_processes
@@ -810,8 +810,8 @@ get_neighbor(const int3 offset)
MPI_Comm_rank(MPI_COMM_WORLD, &pid); MPI_Comm_rank(MPI_COMM_WORLD, &pid);
MPI_Comm_size(MPI_COMM_WORLD, &num_processes); MPI_Comm_size(MPI_COMM_WORLD, &num_processes);
const int n = floor(cbrt(num_processes)); const int n = (int)floor(cbrt((float)num_processes));
ERRCHK_ALWAYS(ceil(cbrt(num_processes)) == n); ERRCHK_ALWAYS(ceil(cbrt((float)num_processes)) == n);
ERRCHK_ALWAYS(n * n * n == num_processes); ERRCHK_ALWAYS(n * n * n == num_processes);
return mod(pid + offset.x, n) + offset.y * n + offset.z * n * n; return mod(pid + offset.x, n) + offset.y * n + offset.z * n * n;