mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Correct the HyperLogLog stale cache flag to prevent unnecessary computations.
Set the MSB as documented.
This commit is contained in:
parent
67133d2f48
commit
ba52cd06c8
@ -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<<HLL_P) /* With P=14, 16384 registers. */
|
||||
@ -953,7 +953,7 @@ double hllRawSum(uint8_t *registers, double *PE, int *ezp) {
|
||||
return E;
|
||||
}
|
||||
|
||||
/* Return the approximated cardinality of the set based on the armonic
|
||||
/* Return the approximated cardinality of the set based on the harmonic
|
||||
* mean of the registers values. 'hdr' points to the start of the SDS
|
||||
* representing the String object holding the HLL representation.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user