From 7f603418124111e43c7002480f3be60e395ece69 Mon Sep 17 00:00:00 2001 From: Fabio Salvini Date: Tue, 13 Dec 2016 19:03:26 +0100 Subject: [PATCH] Removed unnecessary castings --- src/impl/mpi_line.c | 2 +- src/impl/mpi_line_async.c | 2 +- src/impl/omp.c | 2 +- src/impl/sequential.c | 2 +- src/impl/sse.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/impl/mpi_line.c b/src/impl/mpi_line.c index cd77e30..7516574 100644 --- a/src/impl/mpi_line.c +++ b/src/impl/mpi_line.c @@ -67,7 +67,7 @@ float *compute_jacobi(int rank, int numprocs, int n, float init_value, float thr for (i = 1; i <= rows; i++) { for (j = 1; j <= n; j++) { new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); - max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); + max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); new_x[IDX(nb, i, j)] = new_value; } } diff --git a/src/impl/mpi_line_async.c b/src/impl/mpi_line_async.c index 5ace001..85ea882 100644 --- a/src/impl/mpi_line_async.c +++ b/src/impl/mpi_line_async.c @@ -77,7 +77,7 @@ float *compute_jacobi(int rank, int numprocs, int n, float init_value, float thr for (i = 1; i <= rows; i++) { for (j = 1; j <= n; j++) { new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); - max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); + max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); new_x[IDX(nb, i, j)] = new_value; } } diff --git a/src/impl/omp.c b/src/impl/omp.c index 0621942..f323372 100644 --- a/src/impl/omp.c +++ b/src/impl/omp.c @@ -45,7 +45,7 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int * for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); - max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); + max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); new_x[IDX(nb, i, j)] = new_value; } } diff --git a/src/impl/sequential.c b/src/impl/sequential.c index 4ed366d..9d8b676 100644 --- a/src/impl/sequential.c +++ b/src/impl/sequential.c @@ -42,7 +42,7 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int * for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); - max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); + max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); new_x[IDX(nb, i, j)] = new_value; } } diff --git a/src/impl/sse.c b/src/impl/sse.c index 6278eb6..34b75fc 100644 --- a/src/impl/sse.c +++ b/src/impl/sse.c @@ -59,12 +59,12 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int * diff_vec = _mm_sub_ps(diff_vec, tmp_vec); _mm_storeu_ps(diffs, diff_vec); for (k = 0; k < 4; k++) { - max_diff = (float) fmaxf(max_diff, fabs(diffs[k])); + max_diff = fmaxf(max_diff, fabs(diffs[k])); } } for (j = n_mult; j <= n; j++) { new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); - max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); + max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)])); new_x[IDX(nb, i, j)] = new_value; } }