MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hllDenseSet

Function hllDenseSet

app/redis-6.2.6/src/hyperloglog.c:493–503  ·  view source on GitHub ↗

Low level function to set the dense HLL register at 'index' to the * specified value if the current value is smaller than 'count'. * * 'registers' is expected to have room for HLL_REGISTERS plus an * additional byte on the right. This requirement is met by sds strings * automatically since they are implicitly null terminated. * * The function always succeed, however if as a result of the op

Source from the content-addressed store, hash-verified

491 * the approximated cardinality changed, 1 is returned. Otherwise 0
492 * is returned. */
493int hllDenseSet(uint8_t *registers, long index, uint8_t count) {
494 uint8_t oldcount;
495
496 HLL_DENSE_GET_REGISTER(oldcount,registers,index);
497 if (count > oldcount) {
498 HLL_DENSE_SET_REGISTER(registers,index,count);
499 return 1;
500 } else {
501 return 0;
502 }
503}
504
505/* "Add" the element in the dense hyperloglog data structure.
506 * Actually nothing is added, but the max 0 pattern counter of the subset

Callers 3

hllDenseAddFunction · 0.85
hllSparseSetFunction · 0.85
pfmergeCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected