From f8babb62e07e0f0a89dda9e3d0d64db0fcb4e87e Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 19 Jul 2021 15:06:25 +0200 Subject: [PATCH] [pvs-studio] Simplify boolean expressions. --- src/kernel/lmm/maxmin.cpp | 2 +- src/mc/compare.cpp | 2 +- src/smpi/mpi/smpi_request.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index 4f347175d6..1586f5e3b9 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -939,7 +939,7 @@ int Constraint::get_variable_amount() const void Constraint::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb) { - xbt_assert(!cb || (cb && policy == SharingPolicy::NONLINEAR), + xbt_assert(policy == SharingPolicy::NONLINEAR || not cb, "Invalid sharing policy for constraint. Callback should be used with NONLINEAR sharing policy"); sharing_policy_ = policy; dyn_constraint_cb_ = cb; diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index ce9121e914..f2a09f48c3 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -880,7 +880,7 @@ static bool heap_area_differ(const RemoteProcess& process, StateComparator& stat } // Check if the blocks are already matched together: - if (state.equals_to_<1>(block1, frag1).valid_ && state.equals_to_<2>(block2, frag2).valid_ && offset1 == offset2 && + if (state.equals_to_<1>(block1, frag1).valid_ && state.equals_to_<2>(block2, frag2).valid_ && state.fragmentsEqual(block1, frag1, block2, frag2)) { if (match_pairs) state.match_equals(previous); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index d6abc90aaf..880763c869 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -1070,7 +1070,7 @@ int Request::waitany(int count, MPI_Request requests[], MPI_Status * status) // This is a finished detached request, let's return this one comms.clear(); // don't do the waitany call afterwards index = i; - if (requests[index] != MPI_REQUEST_NULL && (requests[index])->flags_ & MPI_REQ_NBC) + if (requests[index]->flags_ & MPI_REQ_NBC) finish_nbc_requests(&requests[index], 0); finish_wait(&requests[i], status); // cleanup if refcount = 0 if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags_ & MPI_REQ_NON_PERSISTENT)) -- 2.20.1