From cdb6ecd3df93a73f169fe3f0d8e0e846d699f95d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 25 Oct 2017 16:35:39 +0200 Subject: [PATCH] Merge if statements. --- src/kernel/routing/FloydZone.cpp | 11 +++++------ src/mc/compare.cpp | 25 +++++++++++-------------- src/smpi/mpi/smpi_request.cpp | 11 +++++------ 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index b434384bcd..4162fa4cb7 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -191,12 +191,11 @@ void FloydZone::seal() for (unsigned int c = 0; c < table_size; c++) { for (unsigned int a = 0; a < table_size; a++) { for (unsigned int b = 0; b < table_size; b++) { - if (TO_FLOYD_COST(a, c) < DBL_MAX && TO_FLOYD_COST(c, b) < DBL_MAX) { - if (fabs(TO_FLOYD_COST(a, b) - DBL_MAX) < std::numeric_limits::epsilon() || - (TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b) < TO_FLOYD_COST(a, b))) { - TO_FLOYD_COST(a, b) = TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b); - TO_FLOYD_PRED(a, b) = TO_FLOYD_PRED(c, b); - } + if (TO_FLOYD_COST(a, c) < DBL_MAX && TO_FLOYD_COST(c, b) < DBL_MAX && + (fabs(TO_FLOYD_COST(a, b) - DBL_MAX) < std::numeric_limits::epsilon() || + (TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b) < TO_FLOYD_COST(a, b)))) { + TO_FLOYD_COST(a, b) = TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b); + TO_FLOYD_PRED(a, b) = TO_FLOYD_PRED(c, b); } } } diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 0e3887d570..386e017029 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -1031,14 +1031,12 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index, return 0; } - if (type_size != -1) { - if (type_size != (ssize_t) heapinfo1->busy_block.busy_size - && type_size != (ssize_t) heapinfo2->busy_block.busy_size - && (type->name.empty() || type->name == "struct s_smx_context")) { - if (match_pairs) - state.match_equals(previous); - return -1; - } + if (type_size != -1 && type_size != (ssize_t)heapinfo1->busy_block.busy_size && + type_size != (ssize_t)heapinfo2->busy_block.busy_size && + (type->name.empty() || type->name == "struct s_smx_context")) { + if (match_pairs) + state.match_equals(previous); + return -1; } if (heapinfo1->busy_block.size != heapinfo2->busy_block.size) @@ -1098,12 +1096,11 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index, } // Check if the blocks are already matched together: - if (state.equals_to1_(block1, frag1).valid_ && state.equals_to2_(block2, frag2).valid_) { - if (offset1==offset2 && state.fragmentsEqual(block1, frag1, block2, frag2)) { - if (match_pairs) - state.match_equals(previous); - return 0; - } + if (state.equals_to1_(block1, frag1).valid_ && state.equals_to2_(block2, frag2).valid_ && offset1 == offset2 && + state.fragmentsEqual(block1, frag1, block2, frag2)) { + if (match_pairs) + state.match_equals(previous); + return 0; } // Compare the size of both fragments: if (heapinfo1->busy_frag.frag_size[frag1] != heapinfo2->busy_frag.frag_size[frag2]) { diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 10a6da27aa..0ed24faddd 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -692,12 +692,11 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status) if (((req->flags_ & ACCUMULATE) != 0) || (datatype->flags() & DT_FLAG_DERIVED)) { // && (not smpi_is_shared(req->old_buf_))){ - if (not smpi_process()->replaying()) { - if (smpi_privatize_global_variables != 0 && (static_cast(req->old_buf_) >= smpi_data_exe_start) && - ((char*)req->old_buf_ < smpi_data_exe_start + smpi_data_exe_size)) { - XBT_VERB("Privatization : We are unserializing to a zone in global memory Switch data segment "); - smpi_switch_data_segment(smpi_process()->index()); - } + if (not smpi_process()->replaying() && smpi_privatize_global_variables != 0 && + static_cast(req->old_buf_) >= smpi_data_exe_start && + static_cast(req->old_buf_) < smpi_data_exe_start + smpi_data_exe_size) { + XBT_VERB("Privatization : We are unserializing to a zone in global memory Switch data segment "); + smpi_switch_data_segment(smpi_process()->index()); } if(datatype->flags() & DT_FLAG_DERIVED){ -- 2.20.1