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
f1b76081
Commit
f1b76081
authored
Mar 31, 2014
by
antirez
Browse files
HLLMERGE fixed by adding a... missing loop!
parent
0c9f06a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hyperloglog.c
View file @
f1b76081
...
@@ -544,7 +544,7 @@ void hllCountCommand(redisClient *c) {
...
@@ -544,7 +544,7 @@ void hllCountCommand(redisClient *c) {
void
hllMergeCommand
(
redisClient
*
c
)
{
void
hllMergeCommand
(
redisClient
*
c
)
{
uint8_t
max
[
REDIS_HLL_REGISTERS
];
uint8_t
max
[
REDIS_HLL_REGISTERS
];
uint8_t
*
registers
;
uint8_t
*
registers
;
int
j
;
int
j
,
i
;
/* Compute an HLL with M[i] = MAX(M[i]_j).
/* Compute an HLL with M[i] = MAX(M[i]_j).
* We we the maximum into the max array of registers. We'll write
* We we the maximum into the max array of registers. We'll write
...
@@ -566,11 +566,13 @@ void hllMergeCommand(redisClient *c) {
...
@@ -566,11 +566,13 @@ void hllMergeCommand(redisClient *c) {
return
;
return
;
}
}
/*
Get the register and set it at max[j] if it's the greatest
/*
Merge with this HLL with our 'max' HHL by setting max[i]
*
value so far
. */
*
to MAX(max[i],hll[i])
. */
registers
=
o
->
ptr
;
registers
=
o
->
ptr
;
HLL_GET_REGISTER
(
val
,
registers
,
j
);
for
(
i
=
0
;
i
<
REDIS_HLL_REGISTERS
;
i
++
)
{
if
(
val
>
max
[
j
])
max
[
j
]
=
val
;
HLL_GET_REGISTER
(
val
,
registers
,
i
);
if
(
val
>
max
[
i
])
max
[
i
]
=
val
;
}
}
}
/* Create / unshare the destination key's value if needed. */
/* Create / unshare the destination key's value if needed. */
...
...
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