mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
re-use same hash class for all add operations
This commit is contained in:
parent
18c10f3cb5
commit
83ce77e575
3 changed files with 11 additions and 14 deletions
|
@ -54,20 +54,7 @@ function hll_cardinality_add%(handle: opaque of cardinality, elem: any%): bool
|
|||
return new Val(0, TYPE_BOOL);
|
||||
}
|
||||
|
||||
int status = 0;
|
||||
|
||||
TypeList* tl = new TypeList(elem->Type());
|
||||
tl->Append(elem->Type());
|
||||
CompositeHash* hll_hash = new CompositeHash(tl);
|
||||
Unref(tl);
|
||||
|
||||
HashKey* key = hll_hash->ComputeHash(elem, 1);
|
||||
uint64_t hash = key->Hash();
|
||||
|
||||
CardinalityCounter* h = cv->Get();
|
||||
h->addElement(hash);
|
||||
|
||||
delete hll_hash;
|
||||
cv->Add(elem);
|
||||
return new Val(1, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue