Skip to content

Commit

Permalink
maybe fix more clang14 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jul 18, 2022
1 parent 7bc18d2 commit 579c74b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
16 changes: 11 additions & 5 deletions src/s2/s2edge_distances.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,16 @@ S1Angle GetDistance(const S2Point& x, const S2Point& a, const S2Point& b) {
}

// dd: changed return type to int because on new clang we get:
// s2/s2edge_distances.cc:282:11: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
// warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
int UpdateMinDistance(const S2Point& x, const S2Point& a, const S2Point& b,
S1ChordAngle* min_dist) {
return AlwaysUpdateMinDistance<false>(x, a, b, min_dist);
}

bool UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
S1ChordAngle* max_dist) {
// dd: changed return type to int because on new clang we get:
// warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
int UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
S1ChordAngle* max_dist) {
auto dist = max(S1ChordAngle(x, a), S1ChordAngle(x, b));
if (dist > S1ChordAngle::Right()) {
AlwaysUpdateMinDistance<true>(-x, a, b, &dist);
Expand Down Expand Up @@ -264,7 +266,9 @@ S2Point Project(const S2Point& x, const S2Point& a, const S2Point& b) {
return Project(x, a, b, S2::RobustCrossProd(a, b));
}

bool UpdateEdgePairMinDistance(
// dd: changed return type to int because on new clang we get:
// warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
int UpdateEdgePairMinDistance(
const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* min_dist) {
Expand All @@ -287,7 +291,9 @@ bool UpdateEdgePairMinDistance(
UpdateMinDistance(b1, a0, a1, min_dist));
}

bool UpdateEdgePairMaxDistance(
// dd: changed return type to int because on new clang we get:
// warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
int UpdateEdgePairMaxDistance(
const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* max_dist) {
Expand Down
16 changes: 8 additions & 8 deletions src/s2/s2edge_distances.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ int UpdateMinDistance(const S2Point& x, const S2Point& a, const S2Point& b,
// If the maximum distance from X to the edge AB is greater than "max_dist",
// this method updates "max_dist" and returns true. Otherwise it returns false.
// The case A == B is handled correctly.
bool UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
S1ChordAngle* max_dist);
int UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
S1ChordAngle* max_dist);

// Returns the maximum error in the result of UpdateMinDistance (and
// associated functions such as UpdateMinInteriorDistance, IsDistanceLess,
Expand Down Expand Up @@ -147,15 +147,15 @@ S2Point InterpolateAtDistance(S1Angle ax, const S2Point& a, const S2Point& b);
// Like UpdateMinDistance(), but computes the minimum distance between the
// given pair of edges. (If the two edges cross, the distance is zero.)
// The cases a0 == a1 and b0 == b1 are handled correctly.
bool UpdateEdgePairMinDistance(const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* min_dist);
int UpdateEdgePairMinDistance(const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* min_dist);

// As above, but for maximum distances. If one edge crosses the antipodal
// reflection of the other, the distance is Pi.
bool UpdateEdgePairMaxDistance(const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* max_dist);
int UpdateEdgePairMaxDistance(const S2Point& a0, const S2Point& a1,
const S2Point& b0, const S2Point& b1,
S1ChordAngle* max_dist);

// Returns the pair of points (a, b) that achieves the minimum distance
// between edges a0a1 and b0b1, where "a" is a point on a0a1 and "b" is a
Expand Down

0 comments on commit 579c74b

Please sign in to comment.