Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ba52cd06
Commit
ba52cd06
authored
May 18, 2014
by
Mike Trinkala
Browse files
Correct the HyperLogLog stale cache flag to prevent unnecessary computations.
Set the MSB as documented.
parent
67133d2f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/hyperloglog.c
View file @
ba52cd06
...
@@ -188,8 +188,8 @@ struct hllhdr {
...
@@ -188,8 +188,8 @@ struct hllhdr {
};
};
/* The cached cardinality MSB is used to signal validity of the cached value. */
/* 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_INVALIDATE_CACHE(hdr) (hdr)->card[
7
] |= (1<<7)
#define HLL_VALID_CACHE(hdr) (((hdr)->card[
0
] & (1<<7)) == 0)
#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_P 14
/* The greater is P, the smaller the error. */
#define HLL_REGISTERS (1<<HLL_P)
/* With P=14, 16384 registers. */
#define HLL_REGISTERS (1<<HLL_P)
/* With P=14, 16384 registers. */
...
@@ -953,7 +953,7 @@ double hllRawSum(uint8_t *registers, double *PE, int *ezp) {
...
@@ -953,7 +953,7 @@ double hllRawSum(uint8_t *registers, double *PE, int *ezp) {
return
E
;
return
E
;
}
}
/* Return the approximated cardinality of the set based on the armonic
/* Return the approximated cardinality of the set based on the
h
armonic
* mean of the registers values. 'hdr' points to the start of the SDS
* mean of the registers values. 'hdr' points to the start of the SDS
* representing the String object holding the HLL representation.
* representing the String object holding the HLL representation.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment