Geo: sync faster decoding from krtm that synched from Ardb.

Instead of successive divisions in iteration the new code uses bitwise
magic to interleave / deinterleave two 32bit values into a 64bit one.
All tests still passing and is measurably faster, so worth it.
This commit is contained in:
antirez
2015-07-01 16:12:08 +02:00
parent d308cadc8a
commit 4160bf0448
2 changed files with 91 additions and 52 deletions

View File

@ -164,7 +164,7 @@ double extractDistanceOrReply(redisClient *c, robj **argv,
* than "5.2144992818115 meters away." We provide 4 digits after the dot
* so that the returned value is decently accurate even when the unit is
* the kilometer. */
inline void addReplyDoubleDistance(redisClient *c, double d) {
void addReplyDoubleDistance(redisClient *c, double d) {
char dbuf[128];
int dlen = snprintf(dbuf, sizeof(dbuf), "%.4f", d);
addReplyBulkCBuffer(c, dbuf, dlen);