From 3961071b20c988bee574cbf28d6c3ba3b48e9567 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 6 Jul 2016 16:38:05 +0200 Subject: Fix signess issue in geohashEstimateStepsByRadius(). --- src/geohash_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/geohash_helper.c b/src/geohash_helper.c index 585d1005b..6e8ca4070 100644 --- a/src/geohash_helper.c +++ b/src/geohash_helper.c @@ -80,7 +80,8 @@ uint8_t geohashEstimateStepsByRadius(double range_meters, double lat) { int geohashBitsComparator(const GeoHashBits *a, const GeoHashBits *b) { /* If step not equal, compare on step. Else, compare on bits. */ - return a->step != b->step ? a->step - b->step : a->bits - b->bits; + return a->step != b->step ? (a->step - b->step) : + ((int64_t)a->bits - (int64_t)b->bits); } int geohashBoundingBox(double longitude, double latitude, double radius_meters, -- cgit v1.2.1