MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / hllSparseAdd

Function hllSparseAdd

src/hyperloglog.cpp:911–916  ·  view source on GitHub ↗

"Add" the element in the sparse hyperloglog data structure. * Actually nothing is added, but the max 0 pattern counter of the subset * the element belongs to is incremented if needed. * * This function is actually a wrapper for hllSparseSet(), it only performs * the hashshing of the element to obtain the index and zeros run length. */

Source from the content-addressed store, hash-verified

909 * This function is actually a wrapper for hllSparseSet(), it only performs
910 * the hashshing of the element to obtain the index and zeros run length. */
911int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
912 long index;
913 uint8_t count = hllPatLen(ele,elesize,&index);
914 /* Update the register if this element produced a longer run of zeroes. */
915 return hllSparseSet(o,index,count);
916}
917
918/* Compute the register histogram in the sparse representation. */
919void hllSparseRegHisto(uint8_t *sparse, int sparselen, int *invalid, int* reghisto) {

Callers 1

hllAddFunction · 0.85

Calls 2

hllPatLenFunction · 0.85
hllSparseSetFunction · 0.85

Tested by

no test coverage detected