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

Function hllRawRegHisto

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

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

Callers 1

hllCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected