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

Function hllRawRegHisto

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

Implements the register histogram calculation for uint8_t data type * which is only used internally as speedup for PFCOUNT with multiple keys. */

Source from the content-addressed store, hash-verified

943/* Implements the register histogram calculation for uint8_t data type
944 * which is only used internally as speedup for PFCOUNT with multiple keys. */
945void hllRawRegHisto(uint8_t *registers, int* reghisto) {
946 uint64_t *word = (uint64_t*) registers;
947 uint8_t *bytes;
948 int j;
949
950 for (j = 0; j < HLL_REGISTERS/8; j++) {
951 if (*word == 0) {
952 reghisto[0] += 8;
953 } else {
954 bytes = (uint8_t*) word;
955 reghisto[bytes[0]]++;
956 reghisto[bytes[1]]++;
957 reghisto[bytes[2]]++;
958 reghisto[bytes[3]]++;
959 reghisto[bytes[4]]++;
960 reghisto[bytes[5]]++;
961 reghisto[bytes[6]]++;
962 reghisto[bytes[7]]++;
963 }
964 word++;
965 }
966}
967
968/* Helper function sigma as defined in
969 * "New cardinality estimation algorithms for HyperLogLog sketches"

Callers 1

hllCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected