Skip to content

Commit 579c74b

Browse files
committed
maybe fix more clang14 errors
1 parent 7bc18d2 commit 579c74b

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/s2/s2edge_distances.cc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,16 @@ S1Angle GetDistance(const S2Point& x, const S2Point& a, const S2Point& b) {
187187
}
188188

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

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

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

290-
bool UpdateEdgePairMaxDistance(
294+
// dd: changed return type to int because on new clang we get:
295+
// warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
296+
int UpdateEdgePairMaxDistance(
291297
const S2Point& a0, const S2Point& a1,
292298
const S2Point& b0, const S2Point& b1,
293299
S1ChordAngle* max_dist) {

src/s2/s2edge_distances.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ int UpdateMinDistance(const S2Point& x, const S2Point& a, const S2Point& b,
6767
// If the maximum distance from X to the edge AB is greater than "max_dist",
6868
// this method updates "max_dist" and returns true. Otherwise it returns false.
6969
// The case A == B is handled correctly.
70-
bool UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
71-
S1ChordAngle* max_dist);
70+
int UpdateMaxDistance(const S2Point& x, const S2Point& a, const S2Point& b,
71+
S1ChordAngle* max_dist);
7272

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

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

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

0 commit comments

Comments
 (0)