Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Nested conditional operators are not Sonar-compliant; revert previous change.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 4 May 2022 06:30:25 +0000 (08:30 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 4 May 2022 09:04:49 +0000 (11:04 +0200)
src/smpi/bindings/smpi_pmpi.cpp

index 56ce529..98d2f46 100644 (file)
@@ -202,10 +202,13 @@ int PMPI_Get_count(const MPI_Status * status, MPI_Datatype datatype, int *count)
   } else if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else {
-    size_t size = datatype->size();
-    *count      = (size == 0)                   ? 0
-                  : (status->count % size != 0) ? MPI_UNDEFINED
-                                                : simgrid::smpi::Status::get_count(status, datatype);
+    if (datatype->size() == 0) {
+      *count = 0;
+    } else if (status->count % datatype->size() != 0) {
+      *count = MPI_UNDEFINED;
+    } else {
+      *count = simgrid::smpi::Status::get_count(status, datatype);
+    }
     return MPI_SUCCESS;
   }
 }