From ebf105703b2c8f60bf02341697b2777ef2b0f142 Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Thu, 30 Jun 2022 23:20:20 +0200
Subject: [PATCH] Fix inverted if branches in `fmpi_domain.c`

---
 src/fmpi_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fmpi_domain.c b/src/fmpi_domain.c
index 8608c4b..a83d4d3 100644
--- a/src/fmpi_domain.c
+++ b/src/fmpi_domain.c
@@ -136,10 +136,10 @@ static struct fmpi_data fmpi_halo_1d(
         memcpy(((char *)halo.raw + type_size), data.raw, (data.size + type_size));
     // Right boundary
     } else if(rank == (size_t)(ctx->mpi->size - 1)) {
-        memcpy(halo.raw, ((const char *)(data.raw) - type_size), size);
+        memcpy(halo.raw, ((const char *)(data.raw) - type_size), (data.size + type_size));
     // Middle
     } else {
-        memcpy(halo.raw, ((const char *)(data.raw) - type_size), (data.size + type_size));
+        memcpy(halo.raw, ((const char *)(data.raw) - type_size), size);
     }
     return halo;
 }
-- 
GitLab