From ba52cd06c87383964a44451f10310f0ea015277e Mon Sep 17 00:00:00 2001 From: Mike Trinkala Date: Sun, 18 May 2014 07:26:26 -0700 Subject: [PATCH] Correct the HyperLogLog stale cache flag to prevent unnecessary computations. Set the MSB as documented. --- src/hyperloglog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hyperloglog.c b/src/hyperloglog.c index 1c6ed45f..ecc061c2 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -188,8 +188,8 @@ struct hllhdr { }; /* The cached cardinality MSB is used to signal validity of the cached value. */ -#define HLL_INVALIDATE_CACHE(hdr) (hdr)->card[0] |= (1<<7) -#define HLL_VALID_CACHE(hdr) (((hdr)->card[0] & (1<<7)) == 0) +#define HLL_INVALIDATE_CACHE(hdr) (hdr)->card[7] |= (1<<7) +#define HLL_VALID_CACHE(hdr) (((hdr)->card[7] & (1<<7)) == 0) #define HLL_P 14 /* The greater is P, the smaller the error. */ #define HLL_REGISTERS (1<