From 0c6e2d518c324a359b6d39c1016c57ca515f9945 Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Thu, 26 Jul 2018 17:26:57 +0300 Subject: [PATCH] Fix compilation errors on OSX (#77) This fixes compilation errors on OSX when -Werror, -Wshorten-64-to-32 flags are passed to the compiler. --- include/mapbox/geojsonvt/simplify.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mapbox/geojsonvt/simplify.hpp b/include/mapbox/geojsonvt/simplify.hpp index b69ae7e..784f085 100644 --- a/include/mapbox/geojsonvt/simplify.hpp +++ b/include/mapbox/geojsonvt/simplify.hpp @@ -37,8 +37,8 @@ inline double getSqSegDist(const vt_point& p, const vt_point& a, const vt_point& inline void simplify(std::vector& 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]); @@ -51,7 +51,7 @@ inline void simplify(std::vector& 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(i) - mid); + auto posToMid = std::abs(static_cast(i) - mid); if (posToMid < minPosToMid) { index = i; minPosToMid = posToMid;