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

Function hllDenseSet

src/hyperloglog.cpp:495–505  ·  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

493 * the approximated cardinality changed, 1 is returned. Otherwise 0
494 * is returned. */
495int hllDenseSet(uint8_t *registers, long index, uint8_t count) {
496 uint8_t oldcount;
497
498 HLL_DENSE_GET_REGISTER(oldcount,registers,index);
499 if (count > oldcount) {
500 HLL_DENSE_SET_REGISTER(registers,index,count);
501 return 1;
502 } else {
503 return 0;
504 }
505}
506
507/* "Add" the element in the dense hyperloglog data structure.
508 * 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