Implements the register histogram calculation for uint8_t data type * which is only used internally as speedup for PFCOUNT with multiple keys. */
| 943 | /* Implements the register histogram calculation for uint8_t data type |
| 944 | * which is only used internally as speedup for PFCOUNT with multiple keys. */ |
| 945 | void 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" |