Skip to content

Commit

Permalink
Merge pull request #40242 from smuzaffar/simulation-llvm14-bitwise
Browse files Browse the repository at this point in the history
[SIMULATION] [LLVM 14] bitwise-instead-of-logical warnings fixed
  • Loading branch information
cmsbuild committed Dec 8, 2022
2 parents e64b97e + adf08d7 commit 57554e3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DataFormats/GeometrySurface/interface/GloballyPositioned.h
Expand Up @@ -154,7 +154,7 @@ class GloballyPositioned {
*/

void setCache() {
if ((thePos.x() == 0.) & (thePos.y() == 0.)) {
if ((thePos.x() == 0.) && (thePos.y() == 0.)) {
thePhi = theEta = 0.; // avoid FPE
} else {
thePhi = thePos.barePhi();
Expand Down
Expand Up @@ -27,15 +27,15 @@ class RectangularPlaneBounds final : public Bounds {
using Bounds::inside;

bool inside(const Local2DPoint& p) const override {
return (std::abs(p.x()) < halfWidth) & (std::abs(p.y()) < halfLength);
return (std::abs(p.x()) < halfWidth) && (std::abs(p.y()) < halfLength);
}

bool inside(const Local3DPoint& p) const override {
return (std::abs(p.x()) < halfWidth) & (std::abs(p.y()) < halfLength) & (std::abs(p.z()) < halfThickness);
return (std::abs(p.x()) < halfWidth) && (std::abs(p.y()) < halfLength) && (std::abs(p.z()) < halfThickness);
}

bool inside(const Local2DPoint& p, float tollerance) const override {
return (std::abs(p.x()) < (halfWidth + tollerance)) & (std::abs(p.y()) < (halfLength + tollerance));
return (std::abs(p.x()) < (halfWidth + tollerance)) && (std::abs(p.y()) < (halfLength + tollerance));
}

bool inside(const Local3DPoint& p, const LocalError& err, float scale = 1.f) const override;
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/interface/SimpleDiskBounds.h
Expand Up @@ -18,8 +18,8 @@ class SimpleDiskBounds final : public Bounds {
float thickness() const override { return theZmax - theZmin; }

bool inside(const Local3DPoint& p) const override {
return ((p.z() > theZmin) & (p.z() < theZmax)) &&
((p.perp2() > theRmin * theRmin) & (p.perp2() < theRmax * theRmax));
return ((p.z() > theZmin) && (p.z() < theZmax)) &&
((p.perp2() > theRmin * theRmin) && (p.perp2() < theRmax * theRmax));
}

using Bounds::inside;
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/src/DiskSectorBounds.cc
Expand Up @@ -7,13 +7,13 @@ bool DiskSectorBounds::inside(const Local3DPoint& p) const {
// and rotated x/y axis
Local3DPoint tmp(p.y() + theOffset, -p.x(), p.z());

return ((tmp.z() >= theZmin) & (tmp.z() <= theZmax) & (tmp.perp2() >= theRmin * theRmin) &
return ((tmp.z() >= theZmin) && (tmp.z() <= theZmax) && (tmp.perp2() >= theRmin * theRmin) &&
(tmp.perp2() <= theRmax * theRmax)) &&
(std::abs(tmp.barePhi()) <= thePhiExtH);
}

bool DiskSectorBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
if ((p.z() < theZmin) | (p.z() > theZmax))
if ((p.z() < theZmin) || (p.z() > theZmax))
return false;

Local2DPoint tmp(p.x(), p.y() + theOffset);
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/src/TrapezoidalPlaneBounds.cc
Expand Up @@ -16,11 +16,11 @@ TrapezoidalPlaneBounds::TrapezoidalPlaneBounds(float be, float te, float a, floa
int TrapezoidalPlaneBounds::yAxisOrientation() const { return (hbotedge > htopedge) ? -1 : 1; }

bool TrapezoidalPlaneBounds::inside(const Local2DPoint& p) const {
return (std::abs(p.y()) < hapothem) & (std::abs(p.x()) < tan_a * std::abs(p.y() + offset));
return (std::abs(p.y()) < hapothem) && (std::abs(p.x()) < tan_a * std::abs(p.y() + offset));
}

bool TrapezoidalPlaneBounds::inside(const Local3DPoint& p) const {
return ((std::abs(p.y()) < hapothem) & (std::abs(p.z()) < hthickness)) &&
return ((std::abs(p.y()) < hapothem) && (std::abs(p.z()) < hthickness)) &&
std::abs(p.x()) < tan_a * std::abs(p.y() + offset);
}

Expand Down

0 comments on commit 57554e3

Please sign in to comment.