Skip to content

Commit

Permalink
Fix compilation errors on OSX (#77)
Browse files Browse the repository at this point in the history
This fixes compilation errors on OSX when -Werror,
-Wshorten-64-to-32 flags are passed to the compiler.
  • Loading branch information
nagineni authored and mourner committed Jul 26, 2018
1 parent 2338c14 commit 0c6e2d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/mapbox/geojsonvt/simplify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ inline double getSqSegDist(const vt_point& p, const vt_point& a, const vt_point&
inline void simplify(std::vector<vt_point>& points, size_t first, size_t last, double sqTolerance) {
double maxSqDist = sqTolerance;
size_t index = 0;
const int32_t mid = (last - first) >> 1;
int32_t minPosToMid = last - first;
const int64_t mid = (last - first) >> 1;
int64_t minPosToMid = last - first;

for (auto i = first + 1; i < last; i++) {
const double sqDist = getSqSegDist(points[i], points[first], points[last]);
Expand All @@ -51,7 +51,7 @@ inline void simplify(std::vector<vt_point>& points, size_t first, size_t last, d
// a workaround to ensure we choose a pivot close to the middle of the list,
// reducing recursion depth, for certain degenerate inputs
// https://github.com/mapbox/geojson-vt/issues/104
auto posToMid = std::abs(static_cast<int32_t>(i) - mid);
auto posToMid = std::abs(static_cast<int64_t>(i) - mid);
if (posToMid < minPosToMid) {
index = i;
minPosToMid = posToMid;
Expand Down

0 comments on commit 0c6e2d5

Please sign in to comment.