From 4347b5975283ca1a591b6c3d4559ed360e187022 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 21 Oct 2018 15:53:34 +0100 Subject: pvs-studio: V728 An excessive check can be simplified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for... "The '(A && !B) || (!A && B)' expression is equivalent to the 'bool(A) != bool(B)' expression" subcases, where the args are already bool Change-Id: Ica8b5c4974c513f7f7ad8acf17ca931e85ebc8af Reviewed-on: https://gerrit.libreoffice.org/62146 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/core/opencl/formulagroupcl.cxx | 8 ++------ sc/source/core/tool/address.cxx | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'sc') diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index d6bfc428ccb8..0f0f5e57f134 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1441,10 +1441,7 @@ public: { pCurDVR = static_cast(tmpCur); - if (! - ((!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) - || (pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed())) - ) + if (pCurDVR->IsStartFixed() != pCurDVR->IsEndFixed()) throw Unhandled(__FILE__, __LINE__); } } @@ -2182,8 +2179,7 @@ static DynamicKernelArgument* VectorRefFactory( const ScCalcConfig& config, cons // Window being too small to justify a parallel reduction if (pDVR->GetRefRowSize() < REDUCE_THRESHOLD) return new DynamicKernelSlidingArgument(config, s, ft, pCodeGen, index); - if ((pDVR->IsStartFixed() && pDVR->IsEndFixed()) || - (!pDVR->IsStartFixed() && !pDVR->IsEndFixed())) + if (pDVR->IsStartFixed() == pDVR->IsEndFixed()) return new ParallelReductionVectorRef(config, s, ft, pCodeGen, index); else // Other cases are not supported as well return new DynamicKernelSlidingArgument(config, s, ft, pCodeGen, index); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 650d3553612c..31a9c816fd5d 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -961,7 +961,7 @@ static bool isValidSingleton( ScRefFlags nFlags, ScRefFlags nFlags2 ) { bool bCols = (nFlags & ScRefFlags::COL_VALID) && ((nFlags & ScRefFlags::COL2_VALID) || (nFlags2 & ScRefFlags::COL_VALID)); bool bRows = (nFlags & ScRefFlags::ROW_VALID) && ((nFlags & ScRefFlags::ROW2_VALID) || (nFlags2 & ScRefFlags::ROW_VALID)); - return (bCols && !bRows) || (!bCols && bRows); + return bCols != bRows; } static ScRefFlags lcl_ScRange_Parse_XL_A1( ScRange& r, -- cgit