summaryrefslogtreecommitdiff
path: root/src/geohash_helper.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-07-06 16:38:05 +0200
committerantirez <antirez@gmail.com>2016-07-06 16:38:05 +0200
commit3961071b20c988bee574cbf28d6c3ba3b48e9567 (patch)
treee13357f9a7ee0459d614ee52616dfb7d825ec894 /src/geohash_helper.c
parent504ccad1fa018b2b432eda092bd536134ee6b39f (diff)
downloadredis-3961071b20c988bee574cbf28d6c3ba3b48e9567.tar.gz
Fix signess issue in geohashEstimateStepsByRadius().
Diffstat (limited to 'src/geohash_helper.c')
-rw-r--r--src/geohash_helper.c3
1 files changed, 2 insertions, 1 deletions
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,