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

Function hllAdd

src/hyperloglog.cpp:1059–1066  ·  view source on GitHub ↗

Call hllDenseAdd() or hllSparseAdd() according to the HLL encoding. */

Source from the content-addressed store, hash-verified

1057
1058/* Call hllDenseAdd() or hllSparseAdd() according to the HLL encoding. */
1059int hllAdd(robj *o, unsigned char *ele, size_t elesize) {
1060 struct hllhdr *hdr = (hllhdr*)ptrFromObj(o);
1061 switch(hdr->encoding) {
1062 case HLL_DENSE: return hllDenseAdd(hdr->registers(),ele,elesize);
1063 case HLL_SPARSE: return hllSparseAdd(o,ele,elesize);
1064 default: return -1; /* Invalid representation. */
1065 }
1066}
1067
1068/* Merge by computing MAX(registers[i],hll[i]) the HyperLogLog 'hll'
1069 * with an array of uint8_t HLL_REGISTERS registers pointed by 'max'.

Callers 2

pfaddCommandFunction · 0.85
pfselftestCommandFunction · 0.85

Calls 4

ptrFromObjFunction · 0.85
hllDenseAddFunction · 0.85
hllSparseAddFunction · 0.85
registersMethod · 0.80

Tested by

no test coverage detected