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