Skip to content

Commit 38ee0bf

Browse files
committed
Guard min/max from macro expansion.
1 parent 21508ee commit 38ee0bf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

include/delaunator.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ inline double circumradius(
6060
if ((bl > 0.0 || bl < 0.0) && (cl > 0.0 || cl < 0.0) && (d > 0.0 || d < 0.0)) {
6161
return x * x + y * y;
6262
} else {
63-
return std::numeric_limits<double>::max();
63+
return (std::numeric_limits<double>::max)();
6464
}
6565
}
6666

@@ -198,10 +198,10 @@ Delaunator::Delaunator(std::vector<double> const& in_coords)
198198
m_edge_stack() {
199199
std::size_t n = coords.size() >> 1;
200200

201-
double max_x = std::numeric_limits<double>::min();
202-
double max_y = std::numeric_limits<double>::min();
203-
double min_x = std::numeric_limits<double>::max();
204-
double min_y = std::numeric_limits<double>::max();
201+
double max_x = (std::numeric_limits<double>::min)();
202+
double max_y = (std::numeric_limits<double>::min)();
203+
double min_x = (std::numeric_limits<double>::max)();
204+
double min_y = (std::numeric_limits<double>::max)();
205205
std::vector<std::size_t> ids;
206206
ids.reserve(n);
207207

@@ -218,7 +218,7 @@ Delaunator::Delaunator(std::vector<double> const& in_coords)
218218
}
219219
const double cx = (min_x + max_x) / 2;
220220
const double cy = (min_y + max_y) / 2;
221-
double min_dist = std::numeric_limits<double>::max();
221+
double min_dist = (std::numeric_limits<double>::max)();
222222

223223
std::size_t i0 = INVALID_INDEX;
224224
std::size_t i1 = INVALID_INDEX;
@@ -236,7 +236,7 @@ Delaunator::Delaunator(std::vector<double> const& in_coords)
236236
const double i0x = coords[2 * i0];
237237
const double i0y = coords[2 * i0 + 1];
238238

239-
min_dist = std::numeric_limits<double>::max();
239+
min_dist = (std::numeric_limits<double>::max)();
240240

241241
// find the point closest to the seed
242242
for (std::size_t i = 0; i < n; i++) {
@@ -251,7 +251,7 @@ Delaunator::Delaunator(std::vector<double> const& in_coords)
251251
double i1x = coords[2 * i1];
252252
double i1y = coords[2 * i1 + 1];
253253

254-
double min_radius = std::numeric_limits<double>::max();
254+
double min_radius = (std::numeric_limits<double>::max)();
255255

256256
// find the third point which forms the smallest circumcircle with the first two
257257
for (std::size_t i = 0; i < n; i++) {
@@ -266,7 +266,7 @@ Delaunator::Delaunator(std::vector<double> const& in_coords)
266266
}
267267
}
268268

269-
if (!(min_radius < std::numeric_limits<double>::max())) {
269+
if (!(min_radius < (std::numeric_limits<double>::max()))) {
270270
throw std::runtime_error("not triangulation");
271271
}
272272

0 commit comments

Comments
 (0)