Call hllDenseAdd() or hllSparseAdd() according to the HLL encoding. */
| 1057 | |
| 1058 | /* Call hllDenseAdd() or hllSparseAdd() according to the HLL encoding. */ |
| 1059 | int 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'. |
no test coverage detected